Skip to content

Commit 7b64246

Browse files
committed
fix a couple of issues with huge profiles
The base64 encode limit was 1MB, but some huge profiles can get over that, so it's now 10MB. transform_save_string_blob() was incorrectly setting a refstring not a blob as an error fallback, potentially leaving a dangling pointer. Thanks Jaume! See https://github.com/jcupitt/libvips/issues/666
1 parent 5df65ec commit 7b64246

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
19/5/17 started 8.5.6
22
- tiff read with start page > 0 could break edge tiles or strips
3+
- raise b64 limit to allow for huge profiles (thanks jaume)
4+
- fix error return in blob save (thanks jaume)
35

46
23/4/17 started 8.5.5
57
- doc polishing

libvips/iofuncs/base64.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Modified on:
6565
- move to vips_ namespace
6666
6767
31/5/15
68-
- oops siged/unsignned mess-up meant we were not padding correctly
68+
- oops siged/unsigned mess-up meant we were not padding correctly
6969
7070
*/
7171

@@ -237,7 +237,9 @@ vips__b64_decode( const char *buffer, size_t *data_length )
237237
int nbits;
238238
int i;
239239

240-
if( output_data_length > 1024 * 1024 ) {
240+
/* A large ICC profile can be a couple of MB, so 10 should be plenty.
241+
*/
242+
if( output_data_length > 10 * 1024 * 1024 ) {
241243
/* We shouldn't really be used for large amounts of data, plus
242244
* we are using an int for offset.
243245
*/

libvips/iofuncs/type.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ transform_save_string_blob( const GValue *src_value, GValue *dest_value )
692692
/* No error return from transform, but we should set it to
693693
* something.
694694
*/
695-
vips_value_set_save_string( dest_value, "" );
695+
vips_value_set_blob( dest_value, NULL, NULL, 0 );
696696
}
697697

698698
GType

0 commit comments

Comments
 (0)