Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openjp2/j2k: replace sprintf calls with snprintf #1450

Merged
merged 2 commits into from
Mar 9, 2023

Commits on Mar 7, 2023

  1. Configuration menu
    Copy the full SHA
    480cc9d View commit details
    Browse the repository at this point in the history
  2. openjp2/j2k: replace sprintf calls with snprintf

    This makes it possible to build j2k.c without warnings using the macOS
    13 SDK. Calls to sprintf are replaced with snprintf, passing appropriate
    buffer sizes.
    
    It doesn’t appear that any of the changed uses of sprintf were actually
    unsafe, so no behavior change is expected aside from SDK compatibility.
    
    The macOS 13 SDK deprecates sprintf as it’s difficult to use safely. The
    deprecation warning message is visible when building C++, but it is not
    normally visible when building plain C code due to a quirk in how
    sprintf is declared in the SDK. However, the deprecation message is
    visible when building plain C under Address Sanitizer
    (-fsanitize=address). This discrepancy was discovered at
    https://crbug.com/1381706 and reported to Apple with a copy at
    https://openradar.appspot.com/FB11761475.
    
    The macOS 13 SDK is packaged in Xcode 14.1, released on 2022-11-01. This
    also affects the iOS 16 SDK and other 2022-era Apple OS SDKs packaged in
    Xcode 14.0, released on 2022-09-12.
    
    j2k.c is visible to the Chromium build via PDFium, and this change is
    needed to allow Chromium to move forward to the macOS 13 SDK.
    
    This change is limited to src/lib/openjp2. Other uses of sprintf were
    found throughout openjpeg.
    markmentovai authored and rouault committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    032b6e9 View commit details
    Browse the repository at this point in the history