From 3b33d912c4e0be9e64be25a18252317dfb227dcf Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 15 Sep 2022 12:57:36 +0100 Subject: [PATCH] fix an undefined shift --- libvips/foreign/heifload.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libvips/foreign/heifload.c b/libvips/foreign/heifload.c index 2a9f371b..83aed76d 100644 --- a/libvips/foreign/heifload.c +++ b/libvips/foreign/heifload.c @@ -306,11 +306,12 @@ static int vips_foreign_load_heif_is_a( const char *buf, int len ) { if( len >= 12 ) { - const guint32 chunk_len = - (unsigned char) buf[0] << 24 | - (unsigned char) buf[1] << 16 | - (unsigned char) buf[2] << 8 | - (unsigned char) buf[3]; + unsigned char *p = (unsigned char *) buf; + guint32 chunk_len = + VIPS_LSHIFT_INT( p[0], 24 ) | + VIPS_LSHIFT_INT( p[1], 16 ) | + VIPS_LSHIFT_INT( p[2], 8 ) | + VIPS_LSHIFT_INT( p[3], 0 ); int i;