Commit Graph

18 Commits (master)

Author SHA1 Message Date
Mike Frysinger 82b08997c1 gd_io: replace internal Putchar with gdPutC
Most code is already using gdPutC instead of Putchar -- only the bmp
module is using Putchar.  It's unclear why we have this other form as
they should be equivalent: gdPutC takes an unsigned char (8-bits) and
then calls ctx->putC while Putchar takes a signed int, masks it with
0xff, and then calls ctx->putC.

The history of these funcs goes back to when it's initially imported
as part of the 1.5.0 release, and there doesn't seem to be any notes
as to why.

So change bmp to use gdPutC so we can delete Putchar entirely.  The
function isn't exported so no one should even notice.  Our tests are
still passing, so hopefully that provide good coverage.
2021-01-11 19:15:17 -05:00
Mike Frysinger 8d63967a52 gd_io: trim unused Putword function 2021-01-11 18:53:50 -05:00
Mike Frysinger 772d0107a6 gdGetIntLSB: use unsigned int to avoid undefined shift behavior
oss-fuzz pointed out:
gd_io.c:174:10: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

See previous commit for more details.
2018-01-25 23:18:56 -05:00
Mike Frysinger 24d352576c gdGetInt: use unsigned int to avoid undefined shift behavior
oss-fuzz pointed out:
gd_io.c:139:14: runtime error: left shift of 199 by 24 places cannot be represented in type 'int'

Switch the temp var we use here to unsigned to avoid that.  We do an
unsigned int to a signed int at the end which is undefined, but since
compilers don't seem to mind that, we won't care just yet.  It also
makes the code match gdGetIntLSB behavior.
2018-01-25 23:02:32 -05:00
pierrejoye e20413bf6b - apply same CS everywhere 2013-04-03 14:23:11 +02:00
Takeshi Abe 7382faef3c fix -Wsign-compare 2013-02-15 15:39:38 +09:00
scottmac 1a022a579b Merge in BMP support, sync up LSB functions. 2008-05-31 19:51:14 +00:00
pajoye a9b03ad5e4 - Update get*Lsb signature 2008-03-12 08:17:25 +00:00
mattias 4b3804e683 - According to the standard, the '#' char must be at column 0 (Thanks Nuno) 2007-10-28 23:09:09 +00:00
mattias 493f11ec08 - ws + cs 2007-10-28 22:04:36 +00:00
mattias 16e401dc6e - ws + cs 2007-10-28 21:15:15 +00:00
scottmac 4bcea8f354 Add two new IO functions to fetch a word or integer when the format is LSB first. 2007-10-09 11:13:56 +00:00
pajoye 8fe1fe254d - #122, initial TGA support (read only) 2007-10-07 19:41:52 +00:00
pierre 62676820bc - sync to 2.0.17 2006-04-05 15:49:38 +00:00
pierre b0243fe7b1 - sync to 2.0.5 2006-04-05 15:44:56 +00:00
pierre 1cdea7482e - sync to 2.0.1 2006-04-05 15:42:56 +00:00
pierre 22d55c5aa4 - sync to 1.8.4 2006-04-05 15:41:55 +00:00
pierre 084ba37adc - sync to 1.6.0 2006-04-05 15:35:53 +00:00