Skip to content

Commit

Permalink
[libpng16] fix: Correct the function png_fp_sub in png.c
Browse files Browse the repository at this point in the history
The code erroneously evaluated `addend0+addend1` in the case where
`addend1` is less than zero.  The function is meant to subtract the
second argument from the first.

This is a cherry-pick of commit 79fd6d1
from branch 'libpng18'.

Reviewed-by: Cosmin Truta <[email protected]>
Signed-off-by: John Bowler <[email protected]>
Signed-off-by: Cosmin Truta <[email protected]>
  • Loading branch information
jbowler authored and ctruta committed Oct 10, 2024
1 parent 7c90057 commit f14d5fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion png.c
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ png_fp_sub(png_int_32 addend0, png_int_32 addend1, int *error)
else if (addend1 < 0)
{
if (0x7fffffff + addend1 >= addend0)
return addend0+addend1;
return addend0-addend1;
}
else
return addend0;
Expand Down

0 comments on commit f14d5fc

Please sign in to comment.