diff --git a/ChangeLog b/ChangeLog index c26954e7..09ebc79c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 9/7/19 started 8.8.2 - better early shutdown in readers +- don't attempt to save large XMP to jpeg [tnextday] 24/5/19 started 8.8.1 - improve realpath() use on older libc diff --git a/libvips/foreign/vips2jpeg.c b/libvips/foreign/vips2jpeg.c index 006e783c..d941b961 100644 --- a/libvips/foreign/vips2jpeg.c +++ b/libvips/foreign/vips2jpeg.c @@ -88,6 +88,8 @@ * - fix a leak with an error during buffer output * 19/4/19 * - fix another leak with error during buffer output + * 19/7/19 + * - ignore large XMP */ /* @@ -285,6 +287,22 @@ write_xmp( Write *write ) (void *) &data, &data_length ) ) return( -1 ); + /* To write >64kb XMP it you need to parse the whole XMP object, + * pull out the most important fields, code just them into the main + * XMP block, then write any remaining XMP objects into a set of + * extended XMP markers. + * + * http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/ \ + * XMPSpecificationPart3.pdf + * + * jpeg_write_marker() with some libjpeg versions will throw a fatal + * error with large chunks. + */ + if( data_length > 60000 ) { + g_warning( "%s", _( "VipsJpeg: large XMP not saved" ) ); + return( 0 ); + } + /* We need to add the magic XML URL to the start, then a null * character, then the data. */