Cleanup JPEG buffer checks.

This commit is contained in:
iabdalkader 2017-01-12 17:31:33 +02:00
parent 9a7c3defc3
commit 11f5d67669

View File

@ -185,7 +185,7 @@ static const uint16_t UVAC_HT[256][2] = {
static void jpeg_put_char(jpeg_buf_t *jpeg_buf, char c)
{
if (jpeg_buf->idx == jpeg_buf->length) {
if ((jpeg_buf->idx+1) >= jpeg_buf->length) {
if (jpeg_buf->realloc == false) {
// Can't realloc buffer
jpeg_buf->overflow = true;
@ -200,7 +200,7 @@ static void jpeg_put_char(jpeg_buf_t *jpeg_buf, char c)
static void jpeg_put_bytes(jpeg_buf_t *jpeg_buf, const void *data, int size)
{
if (jpeg_buf->idx+size >= jpeg_buf->length) {
if ((jpeg_buf->idx+size) >= jpeg_buf->length) {
if (jpeg_buf->realloc == false) {
// Can't realloc buffer
jpeg_buf->overflow = true;