Uploaded image for project: 'PLCrashReporter'
  1. PLCrashReporter
  2. PLCR-532

UTF-8 process names truncated within multibyte codepoint

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2, 1.3
    • Component/s: Crash Log Writer
    • Labels:
      None
    • Environment:

      iOS Simulator 6.1, MacOS X 10.9.2

      Description

      I found out that if I set the Target Product Name to something like "إمتحان إمتحان" (arabic words with space inside) plcrash_log_writer_init crashes with EXC_BAD_ACCESS. Specifically, it crashes on the line #315 in PLCrashLogWriter.m

      writer->process_info.process_name = strdup([pinfo.processName UTF8String]);

      This happens because previously it was unable to get a proper process name on line #98 (same file) and _processName becomes nil:
      _processName = [[NSString alloc] initWithBytes: process_info.kp_proc.p_comm length: strlen(process_info.kp_proc.p_comm) encoding: NSUTF8StringEncoding];

      And then strdup(nil) leads to a crash. I haven't investigated this further yet, for example, it might crash with other languages too, and I don't know yet why it works fine when you don't place a whitespace into a product name.

      I attached the sample code, please, run the Tests-iOS-Simulator target to get the described behavior (I renamed the Product name to "إمتحان إمتحان").

        Activity

        Hide
        Landon Fuller added a comment -

        Mike Ash's best guess, with which I concur, is that we're likely hitting MAXCOMLEN within a multi-byte code point.

        Show
        Landon Fuller added a comment - Mike Ash 's best guess, with which I concur, is that we're likely hitting MAXCOMLEN within a multi-byte code point.
        Hide
        Andreas Linde added a comment -

        Another target product name string that is causing this issue: "ガーバトKK"

        Show
        Andreas Linde added a comment - Another target product name string that is causing this issue: "ガーバトKK"
        Hide
        Landon Fuller added a comment -

        This has been fixed, tested against the supplied reproduction case, and merged to master and the 1.2 release branch.

        A new 1.2-rc5 release candidate will be published containing this fix.

        Thanks for the comprehensive bug report and reproduction information.

        Show
        Landon Fuller added a comment - This has been fixed, tested against the supplied reproduction case, and merged to master and the 1.2 release branch. A new 1.2-rc5 release candidate will be published containing this fix. Thanks for the comprehensive bug report and reproduction information.
        Hide
        Landon Fuller added a comment -

        The 1.2-rc5 release candidate containing a fix to this bug has been published: https://www.plcrashreporter.org/download

        Show
        Landon Fuller added a comment - The 1.2-rc5 release candidate containing a fix to this bug has been published: https://www.plcrashreporter.org/download

          People

          • Assignee:
            Landon Fuller
            Reporter:
            Ivan Parfenchuk [X] (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: