From 6755ea70b0f127b62b009cf4867ea29c8f8e36d2 Mon Sep 17 00:00:00 2001 From: fkaelberer Date: Thu, 6 Mar 2014 10:31:18 +0100 Subject: [PATCH] Fix infinite loop in DecodeStream_ensureBuffer() --- src/core/stream.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/stream.js b/src/core/stream.js index a0118c42e..7a5a2f889 100644 --- a/src/core/stream.js +++ b/src/core/stream.js @@ -118,11 +118,13 @@ var DecodeStream = (function DecodeStreamClosure() { current = 0; } var size = 512; - while (size < requested) - size <<= 1; + while (size < requested) { + size *= 2; + } var buffer2 = new Uint8Array(size); - for (var i = 0; i < current; ++i) + for (var i = 0; i < current; ++i) { buffer2[i] = buffer[i]; + } return (this.buffer = buffer2); }, getByte: function DecodeStream_getByte() {