diff options
Diffstat (limited to 'core/src/fxcodec/jbig2/JBig2_Context.cpp')
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_Context.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index 958c4a63e2..399ff68657 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -20,6 +20,7 @@ #include "core/src/fxcodec/jbig2/JBig2_PddProc.h" #include "core/src/fxcodec/jbig2/JBig2_SddProc.h" #include "core/src/fxcodec/jbig2/JBig2_TrdProc.h" +#include "third_party/base/stl_util.h" namespace { @@ -637,9 +638,11 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, if (m_bIsGlobal && kSymbolDictCacheMaxSize > 0) { std::unique_ptr<CJBig2_SymbolDict> value = pSegment->m_Result.sd->DeepCopy(); - while (m_pSymbolDictCache->size() >= kSymbolDictCacheMaxSize) { + int size = pdfium::CollectionSize<int>(*m_pSymbolDictCache); + while (size >= kSymbolDictCacheMaxSize) { delete m_pSymbolDictCache->back().second; m_pSymbolDictCache->pop_back(); + --size; } m_pSymbolDictCache->push_front(CJBig2_CachePair(key, value.release())); } |