summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_HuffmanTable.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_HuffmanTable.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
index a4998e99cf..1127f52a52 100644
--- a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
+++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
@@ -7,6 +7,7 @@
#include "core/fxcodec/jbig2/JBig2_HuffmanTable.h"
#include <algorithm>
+#include <limits>
#include <vector>
#include "core/fxcodec/jbig2/JBig2_BitStream.h"
@@ -52,7 +53,9 @@ bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) {
uint32_t HTLOW;
uint32_t HTHIGH;
if (pStream->readInteger(&HTLOW) == -1 ||
- pStream->readInteger(&HTHIGH) == -1) {
+ pStream->readInteger(&HTHIGH) == -1 ||
+ HTLOW > static_cast<uint32_t>(std::numeric_limits<int>::max()) ||
+ HTHIGH > static_cast<uint32_t>(std::numeric_limits<int>::max())) {
return false;
}