Bug 691859

Summary: unexpected OOM in fz_copydict
Product: MuPDF Reporter: zeniko
Component: fitzAssignee: Tor Andersson <tor.andersson>
Status: RESOLVED FIXED    
Severity: normal CC: dsdutkiewicz
Priority: P4    
Version: unspecified   
Hardware: All   
OS: All   
Customer: Word Size: ---

Description zeniko 2010-12-30 17:01:23 UTC
Another excerpt from http://software.zeniko.ch/sumatrapdf/SumatraMuPDF.patch :

diff -r d8a40bcdfffd fitz/obj_dict.c
--- a/fitz/obj_dict.c	Wed Dec 29 22:19:13 2010 +0100
+++ b/fitz/obj_dict.c	Thu Dec 30 17:51:28 2010 +0100
@@ -46,10 +46,11 @@ fz_newdict(int initialcap)
 fz_copydict(fz_obj *obj)
 {
 	fz_obj *new;
 	int i;
 
+	obj = fz_resolveindirect(obj); /* SumatraPDF: else obj->u.d.cap might be way off */
 	if (!fz_isdict(obj))
 		fz_throw("assert: not a dict (%s)", fz_objkindstr(obj));
 
 	new = fz_newdict(obj->u.d.cap);
 	for (i = 0; i < fz_dictlen(obj); i++)

BTW: That file SumatraMuPDF.patch contains dozens of smaller and larger bug fixes and feature additions to MuPDF. Is there any reason not to merge most of these into your repository?