summaryrefslogtreecommitdiffstats
path: root/crypto/objects/obj_dat.c
diff options
context:
space:
mode:
authorDrokov Pavel <drokov@rutoken.ru>2024-01-12 02:10:17 -0500
committerTomas Mraz <tomas@openssl.org>2024-01-15 10:49:25 +0100
commit486ab0fb003d05f89620662260486d31bd3faa8c (patch)
treee87c6bddf813fec92eacb48f120bd88d67189b6e /crypto/objects/obj_dat.c
parent441b3b7ba15d5dc6e034b030bd8b88ce596f53ba (diff)
Fix arithmetic expression overflow
If the value of a->length is large (>= 2^12), then an integer overflow will occur for the signed type, which according to the C standard is UB. CLA: trivial Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23274)
Diffstat (limited to 'crypto/objects/obj_dat.c')
-rw-r--r--crypto/objects/obj_dat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index ebde562477..30a63bbbd9 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -128,7 +128,7 @@ static unsigned long added_obj_hash(const ADDED_OBJ *ca)
a = ca->obj;
switch (ca->type) {
case ADDED_DATA:
- ret = a->length << 20L;
+ ret = (unsigned long)a->length << 20UL;
p = (unsigned char *)a->data;
for (i = 0; i < a->length; i++)
ret ^= p[i] << ((i * 3) % 24);