PDF signature causes crash



Hi -
unknown form fields lead to NULL dereferences in
ev_form_field_from_poppler_field() and
pdf_document_forms_get_form_fields().
The appended patch fixes this for me.

best regards
Matthias





-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDirig'in Baerbel Brumme-Bothe
Vorstand: Prof. Dr. Achim Bachem (Vorsitzender), Dr. Ulrich Krafft (stellv. 
Vorsitzender)
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
$NetBSD$

--- ./backend/pdf/ev-poppler.cc.orig	2007-10-02 15:42:05.000000000 +0200
+++ ./backend/pdf/ev-poppler.cc
@@ -2048,7 +2048,7 @@ ev_form_field_from_poppler_field (Popple
 			ev_field = ev_form_field_signature_new (id);
 			break;
 	        case POPPLER_FORM_FIELD_UNKNOWN:
-			break;
+			return 0;
 	}
 
 	ev_field->font_size = font_size;
@@ -2077,15 +2077,20 @@ pdf_document_forms_get_form_fields (EvDo
  	for (list = fields; list; list = list->next) {
  		PopplerFormFieldMapping *mapping;
  		EvFormFieldMapping *field_mapping;
-		
+		EvFormField *f;
+
  		mapping = (PopplerFormFieldMapping *)list->data;
 
+		f = ev_form_field_from_poppler_field (mapping->field);
+		if (!f)
+			continue;
+
  		field_mapping = g_new0 (EvFormFieldMapping, 1);
 		field_mapping->x1 = mapping->area.x1;
 		field_mapping->x2 = mapping->area.x2;
 		field_mapping->y1 = height - mapping->area.y2;
 		field_mapping->y2 = height - mapping->area.y1;
-		field_mapping->field = ev_form_field_from_poppler_field (mapping->field);
+		field_mapping->field = f;
 		field_mapping->field->page = page;
 		
 		retval = g_list_prepend (retval, field_mapping);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]