Not relying on the xref in the parser
This commit is contained in:
		
							parent
							
								
									8c727860dd
								
							
						
					
					
						commit
						2f98d18dc1
					
				| @ -162,6 +162,10 @@ var Parser = (function ParserClosure() { | |||||||
| 
 | 
 | ||||||
|       return imageStream; |       return imageStream; | ||||||
|     }, |     }, | ||||||
|  |     fetchIfRef: function parserFetchIfRef(obj) { | ||||||
|  |       // not relying on the xref.fetchIfRef -- xref might not be set
 | ||||||
|  |       return isRef(obj) ? this.xref.fetch(obj) : obj; | ||||||
|  |     }, | ||||||
|     makeStream: function parserMakeStream(dict, cipherTransform) { |     makeStream: function parserMakeStream(dict, cipherTransform) { | ||||||
|       var lexer = this.lexer; |       var lexer = this.lexer; | ||||||
|       var stream = lexer.stream; |       var stream = lexer.stream; | ||||||
| @ -171,10 +175,7 @@ var Parser = (function ParserClosure() { | |||||||
|       var pos = stream.pos; |       var pos = stream.pos; | ||||||
| 
 | 
 | ||||||
|       // get length
 |       // get length
 | ||||||
|       var length = dict.get('Length'); |       var length = this.fetchIfRef(dict.get('Length')); | ||||||
|       var xref = this.xref; |  | ||||||
|       if (xref) |  | ||||||
|         length = xref.fetchIfRef(length); |  | ||||||
|       if (!isInt(length)) { |       if (!isInt(length)) { | ||||||
|         error('Bad ' + length + ' attribute in stream'); |         error('Bad ' + length + ' attribute in stream'); | ||||||
|         length = 0; |         length = 0; | ||||||
| @ -196,9 +197,8 @@ var Parser = (function ParserClosure() { | |||||||
|       return stream; |       return stream; | ||||||
|     }, |     }, | ||||||
|     filter: function parserFilter(stream, dict, length) { |     filter: function parserFilter(stream, dict, length) { | ||||||
|       var xref = this.xref; |       var filter = this.fetchIfRef(dict.get('Filter', 'F')); | ||||||
|       var filter = xref.fetchIfRef(dict.get('Filter', 'F')); |       var params = this.fetchIfRef(dict.get('DecodeParms', 'DP')); | ||||||
|       var params = xref.fetchIfRef(dict.get('DecodeParms', 'DP')); |  | ||||||
|       if (isName(filter)) |       if (isName(filter)) | ||||||
|         return this.makeFilter(stream, filter.name, length, params); |         return this.makeFilter(stream, filter.name, length, params); | ||||||
|       if (isArray(filter)) { |       if (isArray(filter)) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user