mirror of
				https://github.com/michaelrsweet/pdfio.git
				synced 2025-10-31 18:35:45 +01:00 
			
		
		
		
	Fix handling of 0-length streams (Issue #111)
This commit is contained in:
		| @@ -7,6 +7,7 @@ v1.5.1 - YYYY-MM-DD | |||||||
| - Fixed output of special characters in name values (Issue #106) | - Fixed output of special characters in name values (Issue #106) | ||||||
| - Fixed output of special characters in string values (Issue #107) | - Fixed output of special characters in string values (Issue #107) | ||||||
| - Fixed output of large integers in dictionaries (Issue #108) | - Fixed output of large integers in dictionaries (Issue #108) | ||||||
|  | - Fixed handling of 0-length streams (Issue #111) | ||||||
|  |  | ||||||
|  |  | ||||||
| v1.5.0 - 2025-03-06 | v1.5.0 - 2025-03-06 | ||||||
|   | |||||||
| @@ -307,6 +307,7 @@ pdfioObjGetLength(pdfio_obj_t *obj)	// I - Object | |||||||
|  |  | ||||||
|   if ((lenobj = pdfioDictGetObj(obj->value.value.dict, "Length")) == NULL) |   if ((lenobj = pdfioDictGetObj(obj->value.value.dict, "Length")) == NULL) | ||||||
|   { |   { | ||||||
|  |     if (!_pdfioDictGetValue(obj->value.value.dict, "Length")) | ||||||
|       _pdfioFileError(obj->pdf, "Unable to get length of stream."); |       _pdfioFileError(obj->pdf, "Unable to get length of stream."); | ||||||
|     return (0); |     return (0); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -439,7 +439,7 @@ _pdfioStreamOpen(pdfio_obj_t *obj,	// I - Object | |||||||
|   st->pdf = obj->pdf; |   st->pdf = obj->pdf; | ||||||
|   st->obj = obj; |   st->obj = obj; | ||||||
|  |  | ||||||
|   if ((st->remaining = pdfioObjGetLength(obj)) == 0) |   if ((st->remaining = pdfioObjGetLength(obj)) == 0 && !_pdfioDictGetValue(pdfioObjGetDict(obj), "Length")) | ||||||
|   { |   { | ||||||
|     _pdfioFileError(obj->pdf, "No stream data."); |     _pdfioFileError(obj->pdf, "No stream data."); | ||||||
|     goto error; |     goto error; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user