summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/jbig2')
-rw-r--r--core/fxcodec/jbig2/JBig2_BitStream.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp
index dc4beabc4b..3346521aca 100644
--- a/core/fxcodec/jbig2/JBig2_BitStream.cpp
+++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp
@@ -27,6 +27,9 @@ CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream)
CJBig2_BitStream::~CJBig2_BitStream() {}
int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, uint32_t* dwResult) {
+ if (!IsInBound())
+ return -1;
+
uint32_t dwBitPos = getBitPos();
if (dwBitPos > LengthInBits())
return -1;
@@ -46,6 +49,9 @@ int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, uint32_t* dwResult) {
}
int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, int32_t* nResult) {
+ if (!IsInBound())
+ return -1;
+
uint32_t dwBitPos = getBitPos();
if (dwBitPos > LengthInBits())
return -1;