[Pkg-javascript-commits] [pdf.js] 35/116: Modify |getUint16| to correctly handle missing data in Stream, DecodeStream and ChunkedStream
David Prévot
taffit at moszumanska.debian.org
Fri Mar 6 16:19:58 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 6dfc73a5da34197e13ea1ca120be0880bfe2b8c1
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Fri Jan 9 18:15:17 2015 +0100
Modify |getUint16| to correctly handle missing data in Stream, DecodeStream and ChunkedStream
---
src/core/chunked_stream.js | 3 +++
src/core/stream.js | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/src/core/chunked_stream.js b/src/core/chunked_stream.js
index 3bc293a..e760f18 100644
--- a/src/core/chunked_stream.js
+++ b/src/core/chunked_stream.js
@@ -170,6 +170,9 @@ var ChunkedStream = (function ChunkedStreamClosure() {
getUint16: function ChunkedStream_getUint16() {
var b0 = this.getByte();
var b1 = this.getByte();
+ if (b0 === -1 || b1 === -1) {
+ return -1;
+ }
return (b0 << 8) + b1;
},
diff --git a/src/core/stream.js b/src/core/stream.js
index e08114a..687c7c9 100644
--- a/src/core/stream.js
+++ b/src/core/stream.js
@@ -47,6 +47,9 @@ var Stream = (function StreamClosure() {
getUint16: function Stream_getUint16() {
var b0 = this.getByte();
var b1 = this.getByte();
+ if (b0 === -1 || b1 === -1) {
+ return -1;
+ }
return (b0 << 8) + b1;
},
getInt32: function Stream_getInt32() {
@@ -174,6 +177,9 @@ var DecodeStream = (function DecodeStreamClosure() {
getUint16: function DecodeStream_getUint16() {
var b0 = this.getByte();
var b1 = this.getByte();
+ if (b0 === -1 || b1 === -1) {
+ return -1;
+ }
return (b0 << 8) + b1;
},
getInt32: function DecodeStream_getInt32() {
--
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