fix other cases of reading this.buffer before ensureBuffer, too
This commit is contained in:
		
							parent
							
								
									3f713de5fe
								
							
						
					
					
						commit
						d1809be1ec
					
				
							
								
								
									
										13
									
								
								pdf.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								pdf.js
									
									
									
									
									
								
							@ -603,10 +603,8 @@ var PredictorStream = (function() {
 | 
				
			|||||||
        var rowBytes = this.rowBytes;
 | 
					        var rowBytes = this.rowBytes;
 | 
				
			||||||
        var pixBytes = this.pixBytes;
 | 
					        var pixBytes = this.pixBytes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        var buffer = this.buffer;
 | 
					 | 
				
			||||||
        var bufferLength = this.bufferLength;
 | 
					        var bufferLength = this.bufferLength;
 | 
				
			||||||
        this.ensureBuffer(bufferLength + rowBytes);
 | 
					        var buffer this.ensureBuffer(bufferLength + rowBytes);
 | 
				
			||||||
        var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
 | 
					        var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var bits = this.bits;
 | 
					        var bits = this.bits;
 | 
				
			||||||
@ -672,8 +670,7 @@ var PredictorStream = (function() {
 | 
				
			|||||||
        var rawBytes = this.stream.getBytes(rowBytes);
 | 
					        var rawBytes = this.stream.getBytes(rowBytes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var bufferLength = this.bufferLength;
 | 
					        var bufferLength = this.bufferLength;
 | 
				
			||||||
        this.ensureBuffer(bufferLength + pixBytes);
 | 
					        var buffer = this.ensureBuffer(bufferLength + pixBytes);
 | 
				
			||||||
        var buffer = this.buffer;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
 | 
					        var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
 | 
				
			||||||
        var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
 | 
					        var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
 | 
				
			||||||
@ -802,8 +799,7 @@ var Ascii85Stream = (function() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // special code for z
 | 
					        // special code for z
 | 
				
			||||||
        if (c == zCode) {
 | 
					        if (c == zCode) {
 | 
				
			||||||
            this.ensureBuffer(bufferLength + 4);
 | 
					            var buffer = this.ensureBuffer(bufferLength + 4);
 | 
				
			||||||
            var buffer = this.buffer;
 | 
					 | 
				
			||||||
            for (var i = 0; i < 4; ++i)
 | 
					            for (var i = 0; i < 4; ++i)
 | 
				
			||||||
                buffer[bufferLength + i] = 0;
 | 
					                buffer[bufferLength + i] = 0;
 | 
				
			||||||
            this.bufferLength += 4;
 | 
					            this.bufferLength += 4;
 | 
				
			||||||
@ -820,8 +816,7 @@ var Ascii85Stream = (function() {
 | 
				
			|||||||
                if (!c || c == tildaCode)
 | 
					                if (!c || c == tildaCode)
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            this.ensureBuffer(bufferLength + i - 1);
 | 
					            var buffer = this.ensureBuffer(bufferLength + i - 1);
 | 
				
			||||||
            var buffer = this.buffer;
 | 
					 | 
				
			||||||
            this.bufferLength += i - 1;
 | 
					            this.bufferLength += i - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // partial ending;
 | 
					            // partial ending;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user