summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2020-08-26 22:37:31 +0200
committerAlbert Astals Cid <aacid@kde.org>2020-08-26 22:41:46 +0200
commit55eb5c73e5fb609ba56dee28f74e53b2be28fbb7 (patch)
treec3be6927809a3bc68c7eb5615d0a0d3b86ff0f88
parentc09f01b1be772b39b3d160ebdd6d09eac06e375d (diff)
BaseMemStream::getChars: If we're past the end do nothing
-rw-r--r--poppler/Stream.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/poppler/Stream.h b/poppler/Stream.h
index 245f0ab7..5d9ad0c9 100644
--- a/poppler/Stream.h
+++ b/poppler/Stream.h
@@ -694,7 +694,10 @@ private:
{
int n;
- if (nChars <= 0) {
+ if (unlikely(nChars <= 0)) {
+ return 0;
+ }
+ if (unlikely(bufPtr >= bufEnd)) {
return 0;
}
if (bufEnd - bufPtr < nChars) {