[Pkg-javascript-commits] [pdf.js] 66/157: Issue a warning instead of an error for long Names
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 06:46:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 456ad438d8eabdd3b5bfa7568a600323a2b0278e
Author: Rob Wu <rob at robwu.nl>
Date: Fri Jul 10 16:10:24 2015 +0200
Issue a warning instead of an error for long Names
The PDF specification (cited below) specifies a maximum length of a name
in bytes as a minimal architectural limit. This means that PDF *writers*
should not create names that exceed 127 bytes.
It does not forbid PDF *readers* to accept such names though. These
names are only used internally to link PDF objects to other objects. For
these use cases, the lengths of the names do not really matter. Hence I
have changed the implementation to not treat long names as errors, but
warnings.
> (7.3.5) The length of a name shall be subject to an implementation
> limit; see Annex C.
>
> (Annex C.2) Table C.1 describes the minimum architectural limits that
> should be accommodated by conforming readers running on 32-bit
> machines. Because conforming readers may be subject to these limits,
> conforming writers producing PDF files should remain within them.
>
> (Table C.1) name 127 "Maximum length of a name, in bytes."
http://adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
---
src/core/parser.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/core/parser.js b/src/core/parser.js
index d68fb5f..3fc9034 100644
--- a/src/core/parser.js
+++ b/src/core/parser.js
@@ -838,9 +838,8 @@ var Lexer = (function LexerClosure() {
strBuf.push(String.fromCharCode(ch));
}
}
- if (strBuf.length > 128) {
- error('Warning: name token is longer than allowed by the spec: ' +
- strBuf.length);
+ if (strBuf.length > 127) {
+ warn('name token is longer than allowed by the spec: ' + strBuf.length);
}
return Name.get(strBuf.join(''));
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list