[llvm-bugs] [Bug 47918] New: parseSystemVersionPList assumes three numbers in the version number

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 20 08:30:02 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47918

            Bug ID: 47918
           Summary: parseSystemVersionPList assumes three numbers in the
                    version number
           Product: compiler-rt
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: avi at drissman.com
                CC: llvm-bugs at lists.llvm.org

In an (non-public) Chromium bug, https://crbug.com/1138707, we see a crash in
parseSystemVersionPList on macOS Big Sur:

std::__1::__throw_out_of_range(char const*) + stdexcept:0
abort_message + abort_message.cpp:32
parseSystemVersionPList + 
extensions::CpuInfoProvider::QueryInfo() + cpu_info_provider.cc:44

The `extensions` code is from Chromium; parseSystemVersionPList appears to be
the version from LLVM’s compiler-rt/lib/builtins/os_version_check.c.

If we look at the implementation of parseSystemVersionPList on LLVM ToT we see
(https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/builtins/os_version_check.c#L193):

  sscanf(VersionStr, "%d.%d.%d", &GlobalMajor, &GlobalMinor, &GlobalSubminor);

It’s parsing the field “ProductVersion” from
/System/Library/CoreServices/SystemVersion.plist. If we look at that file on
Big Sur (20A5395g in this case) we see:

        <key>ProductVersion</key>
        <string>11.0</string>

and there are only two numbers and one period.

I can’t say with 100% certainty that it is that specific line, but something
appears to occasionally crash Chromium on Big Sur inside a compiler-added
parseSystemVersionPList() call.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201020/16b6a74d/attachment.html>


More information about the llvm-bugs mailing list