com php-src: Better fix for #68601 for perf https://bitbucket .org/libgd/gd-libgd/commits/81e9a993f2893 d651d225646378e3fd1b74654 67:
ext/gd/libgd/gd_gif_in.c
| From: | Stanislav Malyshev | Date: | Mon, 06 Apr 2015 00:36:47 +0000 |
| Subject: | com php-src: Better fix for #68601 for perf https://bitbucket .org/libgd/gd-libgd/commits/81e9a993f2893 d651d225646378e3fd1b74654 67: ext/gd/libgd/gd_gif_in.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86091@lists.php.net to get a copy of this message | ||
Commit: bd31cb756399101234258c5491443531099957c3
Author: Remi Collet <remi@php.net> Wed, 17 Dec 2014 10:59:36 +0100
Committer: Stanislav Malyshev <stas@php.net> Sun, 5 Apr 2015 17:36:47 -0700
Parents: afbf725e7380dfb3ff43a993e43abd9759a66c2b
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bd31cb756399101234258c5491443531099957c3
Log:
Better fix for #68601 for perf
https://bitbucket.org/libgd/gd-libgd/commits/81e9a993f2893d651d225646378e3fd1b7465467
Bugs:
https://bugs.php.net/68601
Changed paths:
M ext/gd/libgd/gd_gif_in.c
Diff:
diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c
index 491e942..f41ec84 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;