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

Fix segfault calling YGJNILogFunc #1344

Closed
wants to merge 1 commit into from

Commits on Aug 18, 2023

  1. Fix segfault calling YGJNILogFunc (facebook#1344)

    Summary:
    X-link: facebook/react-native#39051
    
    Pull Request resolved: facebook#1344
    
    `YGJNILogFunc` has a bug where it uses a `va_list` to determine the length of a printf string, then reuses the same `va_list` later after it has already been iterated through. Even if no arguments are present, this may cause a crash looking something like:
    
    ```
    C  [libsystem_platform.dylib+0xf12]  _platform_strlen+0x12
    C  [libsystem_c.dylib+0x31bf]  __vfprintf+0x1339
    C  [libsystem_c.dylib+0x307ce]  _vsnprintf+0x100
    C  [libsystem_c.dylib+0x6965]  vsnprintf+0x44
    C  [libyoga.dylib+0x5161]  YGJNILogFunc(YGConfig*, YGNode*, YGLogLevel, void*, char const*, __va_list_tag*)+0x59
    ```
    
    Fixing this fixes crashing unit tests which are not explicitly disabled.
    
    Reviewed By: yungsters
    
    Differential Revision: D48388548
    
    fbshipit-source-id: 2a653b4c9c92191e0a0b6f37701cb5297263bd8c
    NickGerleman authored and facebook-github-bot committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    eeda13a View commit details
    Browse the repository at this point in the history