Bug 691859 - unexpected OOM in fz_copydict
Summary: unexpected OOM in fz_copydict
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: fitz (show other bugs)
Version: unspecified
Hardware: All All
: P4 normal
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-30 17:01 UTC by zeniko
Modified: 2011-02-02 15:57 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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?