]> git.parisson.com Git - pdf.js.git/commitdiff
Throw error when pixels don't match
authorArtur Adib <arturadib@gmail.com>
Thu, 8 Dec 2011 22:13:17 +0000 (17:13 -0500)
committerArtur Adib <arturadib@gmail.com>
Thu, 8 Dec 2011 22:13:17 +0000 (17:13 -0500)
src/image.js

index 217e081c21fce0f42c289b06e7bb23968eca93b1..57c6d415f028cc9c7e7ebdb981e5b2aed98bd465 100644 (file)
@@ -198,6 +198,10 @@ var PDFImage = (function pdfImage() {
       var opacityPos = 0;
       var length = width * height * 4;
 
+      // Is there a one-to-one correspondence between pixels in the loop below?
+      if (length !== 4*comps.length/3)
+        error('Number of image pixels mismatch');
+
       for (var i = 0; i < length; i += 4) {
         buffer[i] = comps[compsPos++];
         buffer[i + 1] = comps[compsPos++];