summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf/pdf_optcontent.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pdf/pdf_optcontent.c b/pdf/pdf_optcontent.c
index f6c6faf2a..ebade7722 100644
--- a/pdf/pdf_optcontent.c
+++ b/pdf/pdf_optcontent.c
@@ -367,7 +367,7 @@ static int pdfi_oc_levels_set(pdf_context *ctx, pdfi_oc_levels_t *levels, uint64
byte *new = NULL;
uint64_t newmax;
- if (index > levels->max_flags) {
+ if (index > levels->max_flags - 1) {
/* Expand the flags buffer */
newmax = levels->max_flags + NUM_CONTENT_LEVELS;
if (index > newmax)