From 75185f8be61c2698656f3bb7aeaf8bb3a31db695 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 27 Jan 2026 19:20:55 -0500 Subject: [PATCH] Add NULL check to new page contents code. --- pdfio-page.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdfio-page.c b/pdfio-page.c index 04b0287..9efc96f 100644 --- a/pdfio-page.c +++ b/pdfio-page.c @@ -1,7 +1,7 @@ // // PDF page functions for PDFio. // -// Copyright © 2021-2022 by Michael R Sweet. +// Copyright © 2021-2026 by Michael R Sweet. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. @@ -123,7 +123,8 @@ get_contents(pdfio_obj_t *page) // I - Page object if (page->value.type != PDFIO_VALTYPE_DICT) return (NULL); - contents = _pdfioDictGetValue(page->value.value.dict, "Contents"); + if ((contents = _pdfioDictGetValue(page->value.value.dict, "Contents")) == NULL) + return (NULL); if (contents->type == PDFIO_VALTYPE_INDIRECT) {