Project

General

Profile

Actions

Bug #13427

closed

ppm: overflow in conversion

Added by Toomas Soome almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
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

Actions #1

Updated by Electric Monk almost 3 years ago

  • Gerrit CR set to 1147
Actions #2

Updated by Toomas Soome almost 3 years ago

  • Description updated (diff)
Actions #3

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

Also available in: Atom PDF