improve data_length handling in jpg load

libjpeg uses unsigned ints for data length, so we must use size_t
everywhere.
This commit is contained in:
John Cupitt 2019-08-30 11:00:25 +01:00
parent 3161de3b52
commit 6ea76f9632
2 changed files with 5 additions and 4 deletions

View File

@ -17,6 +17,7 @@
- fix sharpen with sigma 0.5 [2h4dl] - fix sharpen with sigma 0.5 [2h4dl]
- sharpen restores input colourspace - sharpen restores input colourspace
- verify bands/format for coded images - verify bands/format for coded images
- improve data_length handling for jpeg metadata
24/5/19 started 8.8.1 24/5/19 started 8.8.1
- improve realpath() use on older libc - improve realpath() use on older libc

View File

@ -307,7 +307,7 @@ find_chroma_subsample( struct jpeg_decompress_struct *cinfo )
} }
static int static int
attach_blob( VipsImage *im, const char *field, void *data, int data_length ) attach_blob( VipsImage *im, const char *field, void *data, size_t data_length )
{ {
/* Only use the first one. /* Only use the first one.
*/ */
@ -333,7 +333,7 @@ attach_blob( VipsImage *im, const char *field, void *data, int data_length )
* the real XMP. * the real XMP.
*/ */
static int static int
attach_xmp_blob( VipsImage *im, void *data, int data_length ) attach_xmp_blob( VipsImage *im, void *data, size_t data_length )
{ {
char *p = (char *) data; char *p = (char *) data;
int i; int i;
@ -496,7 +496,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
for( p = cinfo->marker_list; p; p = p->next ) { for( p = cinfo->marker_list; p; p = p->next ) {
#ifdef DEBUG #ifdef DEBUG
{ {
printf( "read_jpeg_header: seen %d bytes of APP%d\n", printf( "read_jpeg_header: seen %u bytes of APP%d\n",
p->data_length, p->data_length,
p->marker - JPEG_APP0 ); p->marker - JPEG_APP0 );
@ -593,7 +593,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
default: default:
#ifdef DEBUG #ifdef DEBUG
printf( "read_jpeg_header: " printf( "read_jpeg_header: "
"ignoring %d byte APP%d block\n", "ignoring %u byte APP%d block\n",
p->data_length, p->marker - JPEG_APP0 ); p->data_length, p->marker - JPEG_APP0 );
#endif /*DEBUG*/ #endif /*DEBUG*/
break; break;