We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e921533 + 3ecbef5 commit fc68a9fCopy full SHA for fc68a9f
1 file changed
src/core/flate_stream.js
@@ -151,7 +151,13 @@ class FlateStream extends DecodeStream {
151
152
async getImageData(length, _decoderOptions) {
153
const data = await this.asyncGetBytes();
154
- return data?.subarray(0, length) || this.getBytes(length);
+ if (!data) {
155
+ return this.getBytes(length);
156
+ }
157
+ if (data.length <= length) {
158
+ return data;
159
160
+ return data.subarray(0, length);
161
}
162
163
async asyncGetBytes() {
0 commit comments