ref: 3275df73350782e6972c809301c9c370500b90dd
parent: 4df2541d1575013fdfba378cfb587b3bace0adf7
author: Sebastian Rasmussen <[email protected]>
date: Sun Aug 26 11:16:02 EDT 2018
jbig2dec: Avoid dereferencing pointer before it is tested. Thanks to coverity.
--- a/jbig2.c
+++ b/jbig2.c
@@ -445,7 +445,6 @@
jbig2_word_stream_buf_get_next_word(Jbig2WordStream *self, size_t offset, uint32_t *word)
{
Jbig2WordStreamBuf *z = (Jbig2WordStreamBuf *) self;
- const byte *data = z->data;
uint32_t val = 0;
int ret = 0;
@@ -457,19 +456,19 @@
}
if (offset < z->size) {
- val |= data[offset] << 24;
+ val |= z->data[offset] << 24;
ret++;
}
if (offset + 1 < z->size) {
- val |= data[offset + 1] << 16;
+ val |= z->data[offset + 1] << 16;
ret++;
}
if (offset + 2 < z->size) {
- val |= data[offset + 2] << 8;
+ val |= z->data[offset + 2] << 8;
ret++;
}
if (offset + 3 < z->size) {
- val |= data[offset + 3];
+ val |= z->data[offset + 3];
ret++;
}
*word = val;