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

Compilation warnings #2

Closed
nigelhorne opened this issue Jan 2, 2021 · 1 comment
Closed

Compilation warnings #2

nigelhorne opened this issue Jan 2, 2021 · 1 comment

Comments

@nigelhorne
Copy link

gpdf.c: In function ‘draw_pdf’:
gpdf.c:1348:19: warning: ‘%d’ directive writing between 1 and 10 bytes into a region of size between 4 and 13 [-Wformat-overflow=]
1348 | sprintf(s, "%d, %d", j, i);
| ^~
gpdf.c:1348:14: note: directive argument in the range [0, 2147483647]
1348 | sprintf(s, "%d, %d", j, i);
| ^~~~~~~~
gpdf.c:1348:3: note: ‘sprintf’ output between 5 and 23 bytes into a destination of size 16
1348 | sprintf(s, "%d, %d", j, i);

@billthefarmer
Copy link
Owner

billthefarmer commented Jan 2, 2021

I wrote this in 2016 and haven't touched it since. Gcc has obviously become more pernickety since. That particular line is outputting dimensions in points on a piece of paper which can't be bigger than A0 because, AFAIK, you can't get printers/plotters bigger than that. So it won't overflow the buffer char s[16];. You could make it bigger to make the warning go away or suppress the warning.

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

2 participants