diff options
author | Remi Collet <remi@php.net> | 2014-12-17 10:59:36 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2014-12-17 10:59:36 +0100 |
commit | 5fc2fede9c7c963c950d8b96dcc0f7af88b4d695 (patch) | |
tree | 841e39547f865cab05a912ca01a8b04032b73d98 /ext/gd | |
parent | 5a67d9a2293356cc5bfcf7dad98ace939c6947f8 (diff) | |
download | php-git-5fc2fede9c7c963c950d8b96dcc0f7af88b4d695.tar.gz |
Better fix for #68601 for perf
https://bitbucket.org/libgd/gd-libgd/commits/81e9a993f2893d651d225646378e3fd1b7465467
Diffstat (limited to 'ext/gd')
-rw-r--r-- | ext/gd/libgd/gd_gif_in.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c index 491e9422db..f41ec8460a 100644 --- a/ext/gd/libgd/gd_gif_in.c +++ b/ext/gd/libgd/gd_gif_in.c @@ -400,14 +400,14 @@ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroD scd->lastbit = (2+count)*8 ; } - ret = 0; - for (i = scd->curbit, j = 0; j < code_size; ++i, ++j) - if (i < CSD_BUF_SIZE * 8) { + if ((scd->curbit + code_size - 1) >= (CSD_BUF_SIZE * 8)) { + ret = -1; + } else { + ret = 0; + for (i = scd->curbit, j = 0; j < code_size; ++i, ++j) { ret |= ((scd->buf[i / 8] & (1 << (i % 8))) != 0) << j; - } else { - ret = -1; - break; } + } scd->curbit += code_size; return ret; |