From: "Christoph M. Becker" <cmbecker69@gmx.de> Date: Wed, 18 Jan 2017 21:06:29 +0100 Subject: Fix tiff_invalid_read check --- src/gd_io_dp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gd_io_dp.c b/src/gd_io_dp.c index eda2eeb..cb38794 100644 --- a/src/gd_io_dp.c +++ b/src/gd_io_dp.c @@ -292,6 +292,10 @@ static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len) rlen = dp->realSize - dp->pos; } + if (rlen < 0) { + return 0; + } + memcpy(buf, (void *) ((char *)dp->data + dp->pos), rlen); dp->pos += rlen;