Project

General

Profile

Actions

Bug #13427

closed

ppm: overflow in conversion

Added by Toomas Soome over 1 year ago. Updated over 1 year ago.

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

100%

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.

Testing done: build/install/boot

Actions

Also available in: Atom PDF