]> granicus.if.org Git - php/commitdiff
Fix shift UB in gd_io.c
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 19 Jun 2019 13:06:48 +0000 (15:06 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 19 Jun 2019 13:09:00 +0000 (15:09 +0200)
This has already been fixed upstream in
https://github.com/libgd/libgd/commit/24d352576c024769d18113a28f3be03d54fa1e66
and
https://github.com/libgd/libgd/commit/772d0107a6b00a0d6d7191383fe984f8c018b48c.

ext/gd/libgd/gd_io.c

index 9b5cc0c7ddf8e8e83d6ca16d50b170a0dc533eba..1ca822fc9b6397a3cca2c9a76f6c73f03af45756 100644 (file)
@@ -117,7 +117,7 @@ int gdGetWordLSB(signed short int *result, gdIOCtx *ctx)
 
 int gdGetInt (int *result, gdIOCtx * ctx)
 {
-       int r;
+       unsigned int r;
        r = (ctx->getC) (ctx);
        GD_IO_EOF_CHK(r);
        *result = r << 24;
@@ -141,7 +141,7 @@ int gdGetInt (int *result, gdIOCtx * ctx)
 
 int gdGetIntLSB(signed int *result, gdIOCtx *ctx)
 {
-       int c = 0;
+       unsigned int c;
        unsigned int r = 0;
 
        c = (ctx->getC) (ctx);