From df03908f651f2af837adcca26c08d1a30dd8db87 Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Wed, 1 Mar 2023 17:43:38 +0000
Subject: [PATCH] add some defensive asserts in act_textobj

---
 pdf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pdf.c b/pdf.c
index d1738ee..53ae22f 100644
--- a/pdf.c
+++ b/pdf.c
@@ -1913,7 +1913,8 @@ act_txtobj(const HParseResult *p, void *u)
 		txte = H_CAST(TextEntry, opstream->seq->elements[i]);
 
 		// make sure we are working on the same node as the current node
-		assert(txte && (txte->node == node));
+		assert(txte != NULL);
+		assert(txte->node == node);
 
 		switch (txte->type) {
 		// text state operators
@@ -2018,7 +2019,10 @@ act_txtobj(const HParseResult *p, void *u)
 	// Now concatenate the pieces
 	for (int i =0; i < opstream->seq->used; i++) {
 		txte = H_CAST(TextEntry, opstream->seq->elements[i]);
+		assert(txte != NULL);
+		assert(txte->node == node);
 		ts   = &txte->node->ts;
+		assert(ts->node == node);
 
 		// Process the text operators
 		switch (txte->type) {
-- 
GitLab