summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_streamcontentparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamcontentparser.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index d8e1c1e15d..6211b6a4dd 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -98,8 +98,11 @@ CFX_FloatRect GetShadingBBox(CPDF_ShadingPattern* pShading,
while (!stream.BitStream()->IsEOF()) {
uint32_t flag = 0;
- if (type != kLatticeFormGouraudTriangleMeshShading)
+ if (type != kLatticeFormGouraudTriangleMeshShading) {
+ if (!stream.CanReadFlag())
+ break;
flag = stream.ReadFlag();
+ }
if (!bGouraud && flag) {
point_count -= 4;
@@ -107,6 +110,8 @@ CFX_FloatRect GetShadingBBox(CPDF_ShadingPattern* pShading,
}
for (int i = 0; i < point_count; i++) {
+ if (!stream.CanReadCoords())
+ break;
CFX_PointF origin = stream.ReadCoords();
if (bStarted) {
rect.UpdateRect(origin.x, origin.y);