fix buffer over/underflow errors with jpeg mmap load. ugh. mmap adds

pains to loading.



SVN revision: 62584
This commit is contained in:
Carsten Haitzler 2011-08-19 06:58:33 +00:00
parent 352ec9086c
commit 5f365281fd
1 changed files with 6 additions and 10 deletions

View File

@ -111,22 +111,18 @@ _evas_jpeg_membuf_src_fill(j_decompress_ptr cinfo)
static void
_evas_jpeg_membuf_src_skip(j_decompress_ptr cinfo,
long num_bytes)
long num_bytes)
{
struct jpeg_membuf_src *src = (struct jpeg_membuf_src *)cinfo->src;
long rec = 0;
rec = src->pub.bytes_in_buffer - num_bytes;
if (rec <0)
if ((((long)src->pub.bytes_in_buffer - (long)src->len) > num_bytes) ||
((long)src->pub.bytes_in_buffer < num_bytes))
{
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo));
return;
}
else
{
src->pub.bytes_in_buffer -= num_bytes;
src->pub.next_input_byte += num_bytes;
}
src->pub.bytes_in_buffer -= num_bytes;
src->pub.next_input_byte += num_bytes;
}
static void