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

Array overflow in svg module #33641

Closed
Tracked by #39196
qarmin opened this issue Nov 15, 2019 · 2 comments · Fixed by #49645
Closed
Tracked by #39196

Array overflow in svg module #33641

qarmin opened this issue Nov 15, 2019 · 2 comments · Fixed by #49645

Comments

@qarmin
Copy link
Contributor

qarmin commented Nov 15, 2019

Godot version:
3.2.beta.custom_build. fea3890
OS/device including version:
Ubuntu 19.10
Issue description:
Errors

modules/svg/image_loader_svg.cpp:60:43: runtime error: index 1 out of bounds for type 'NSVGgradientStop [1]'
thirdparty/nanosvg/nanosvgrast.h:1293:47: runtime error: index 2 out of bounds for type 'NSVGgradientStop [1]'
thirdparty/nanosvg/nanosvgrast.h:1302:43: runtime error: index 1 out of bounds for type 'NSVGgradientStop [1]'
thirdparty/nanosvg/nanosvgrast.h:1304:37: runtime error: index 1 out of bounds for type 'NSVGgradientStop [1]'
thirdparty/nanosvg/nanosvgrast.h:1301:41: runtime error: index 1 out of bounds for type 'NSVGgradientStop [1]'
thirdparty/nanosvg/nanosvgrast.h:1303:35: runtime error: index 1 out of bounds for type 'NSVGgradientStop [1]'
thirdparty/nanosvg/nanosvg.h:2161:49: runtime error: division by zero

Steps to reproduce:

  1. Just open editor(errors are shown only when compiled Godot with sanitizers support, but It can be easily tracked when putting breakpoint)
@aaronfranke
Copy link
Member

I opened an upstream bug report here: memononen/nanosvg#170. It seems like a bug to have an array with exactly one item, what's the point?

typedef struct NSVGgradient {
    float xform[6];
    char spread;
    float fx, fy;
    int nstops;
    NSVGgradientStop stops[1]; // here
} NSVGgradient;

@KoBeWi
Copy link
Member

KoBeWi commented Oct 15, 2020

The mentioned issue is still open, so I assume this is still valid.

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

Successfully merging a pull request may close this issue.

4 participants