Actions
Bug #13427
closedppm: overflow in conversion
Start date:
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:
Description
Build error with gcc 10:
../../common/io/ppm/ppm_subr.c: In function 'ppm_stoi': ../../common/io/ppm/ppm_subr.c:998:16: error: overflow in conversion from 'uint_t' {aka 'unsigned int'} to 'int' changes value from '*val = 4294967295' to '-1' [-Werror=overflow] 998 | return (*val = (uint_t)-1); | ~~~~~~^~~~~~~~~~~~~ ../../common/io/ppm/ppm_subr.c: In function 'ppm_convert': ../../common/io/ppm/ppm_subr.c:1070:16: error: overflow in conversion from 'uint_t' {aka 'unsigned int'} to 'int' changes value from '*val = 4294967295' to '-1' [-Werror=overflow] 1070 | return (*val = (uint_t)-1); | ~~~~~~^~~~~~~~~~~~~ ../../common/io/ppm/ppm_subr.c:1081:15: error: overflow in conversion from 'uint_t' {aka 'unsigned int'} to 'int' changes value from '*val = 4294967295' to '-1' [-Werror=overflow] 1081 | return (*val = (uint_t)-1); | ~~~~~~^~~~~~~~~~~~~ cc1: all warnings being treated as errors
Signed versus unsigned values. Instead of -1, use UINT_MAX.
Testing done: build/install/boot
Updated by Electric Monk almost 3 years ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
git commit 90fd277545647a48fe36a73f89288db6ce148c54
commit 90fd277545647a48fe36a73f89288db6ce148c54 Author: Toomas Soome <tsoome@me.com> Date: 2021-01-26T09:20:01.000Z 13427 ppm: overflow in conversion Reviewed by: Igor Kozhukhov <igor@dilos.org> Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
Actions