From 5d16663331afd0bc2edaeb2e49042dc219ce9c2f Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 28 Dec 2023 19:53:34 +0000 Subject: promote Development to Advanced git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4827 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/libpammap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/libpammap.c') diff --git a/lib/libpammap.c b/lib/libpammap.c index 569156fe..a0e7fb55 100644 --- a/lib/libpammap.c +++ b/lib/libpammap.c @@ -102,12 +102,15 @@ static struct tupleint_list_item * allocTupleIntListItem(struct pam * const pamP) { - /* This is complicated by the fact that the last element of a - tupleint_list_item is of variable length, because the last element + /* This is complicated by the fact that the last member of a + tupleint_list_item is of variable length, because the last member of _it_ is of variable length */ struct tupleint_list_item * retval; + if (pamP->depth > (UINT_MAX - sizeof(*retval)) / sizeof(sample)) + pm_error("Depth %u is too large for computation", pamP->depth); + unsigned int const size = sizeof(*retval) - sizeof(retval->tupleint.tuple) + pamP->depth * sizeof(sample); -- cgit 1.4.1