]> git.parisson.com Git - pdf.js.git/commitdiff
Do not fail on splitted hex string
authorVivien Nicolas <21@vingtetun.org>
Mon, 25 Jul 2011 18:39:29 +0000 (20:39 +0200)
committerVivien Nicolas <21@vingtetun.org>
Mon, 25 Jul 2011 18:39:29 +0000 (20:39 +0200)
pdf.js

diff --git a/pdf.js b/pdf.js
index 4bed1a8515b28b097fe78911ae105d13b26ca797..66d922df29bac380ada69531f0af76349e30cbfd 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -2313,11 +2313,16 @@ var Lexer = (function() {
         }
         if (specialChars[ch.charCodeAt(0)] != 1) {
           var x, x2;
-          if (((x = ToHexDigit(ch)) == -1) ||
-              ((x2 = ToHexDigit(stream.getChar())) == -1)) {
+          if ((x = ToHexDigit(ch)) == -1)
             error('Illegal character in hex string');
-            break;
-          }
+
+          ch = stream.getChar();
+          while (specialChars[ch.charCodeAt(0)] == 1)
+            ch = stream.getChar();
+
+          if ((x2 = ToHexDigit(ch)) == -1)
+            error('Illegal character in hex string');
+
           str += String.fromCharCode((x << 4) | x2);
         }
       }