From 31bc055d9a9257cd9863bbd702fe05e41ebce8a7 Mon Sep 17 00:00:00 2001 From: Arne Goedeke <el@laramies.com> Date: Sun, 4 May 2014 01:38:21 +0200 Subject: [PATCH] Image.PNG: do not overwrite elements in returned mapping The code handling private chunks allowed a png file to overwrite entries in the return mapping (those with 4 byte length). While that only applies to sbit and time chunks, its not a useful feature. --- src/modules/Image/encodings/png.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/Image/encodings/png.c b/src/modules/Image/encodings/png.c index 48fde7f2c7..3e2dcb54f7 100644 --- a/src/modules/Image/encodings/png.c +++ b/src/modules/Image/encodings/png.c @@ -1446,7 +1446,8 @@ static void img_png_decode(INT32 args, int mode) ref_push_string(b->item[1].u.string); ref_push_string(b->item[0].u.string); - mapping_insert(m,sp-1,sp-2); + /* do not replace existing entries */ + low_mapping_insert(m,sp-1,sp-2,0); pop_n_elems(2); } } -- GitLab