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

signed integer overflow #561

Open
ghost opened this issue Jun 7, 2024 · 0 comments
Open

signed integer overflow #561

ghost opened this issue Jun 7, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 7, 2024

Hello,

There is a signed integer overflow within the library, within the following tags can trigger this resulting in denial of service within rlottie.

./harness` small.json 
frame count:    1
starting...
/home/harry/rlottie/src/vector/freetype/v_ft_raster.cpp:1385:38: runtime error: signed integer overflow: -2147483648 - 2147483647 cannot be represented in type 'int' 

This can be found here when loading in the Json file:

{
    "v": "0",
    "": [],
    "assets": [
      {
        "": 0
      },
      {
        "": 0,
        "id": "fr000",
        "h": 2
      },
      {
        "": 0
      }
    ],
    "layers": [
      {
        "": 0
      },
      {
        "": 0
      },
      {
        "": 0,
        "ks": {
          "": {
            "": 0
          }
        },
        "ty": 2,
        "refId": "fr000" 
      }
    ]
  }

The overflow occurs when the parameters of refId are given 000 resulting in a overflow. This has to be within the layers function for the bug to be triggered:
https://github.com/Samsung/rlottie/blob/master/src/vector/freetype/v_ft_raster.cpp#L1385C15-L1385C73

    gray_convert_glyph(RAS_VAR);
    params->bbox_cb(ras.bound_left, ras.bound_top,
                    ras.bound_right - ras.bound_left,
                    ras.bound_bottom - ras.bound_top + 1, params->user);

To recreate issue:
compile code with:
harness.cpp.tar.gz

g++   main.cpp  fsanitize=address,undefined fsanitize=address fsanitize=address integer overflow


./application test.json 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants