Project

General

Profile

Bug #13427

ppm: overflow in conversion

Added by Toomas Soome 19 days ago. Updated 19 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
Due date:
% Done:

90%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

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.

#1

Updated by Electric Monk 19 days ago

  • Gerrit CR set to 1147

Also available in: Atom PDF