Blame SOURCES/0011-avahi_dns_packet_consume_uint32-fix-potential-undefi.patch

d59061
From b897ca43ac100d326d118e5877da710eb7f836f9 Mon Sep 17 00:00:00 2001
d59061
From: traffic-millions <60914101+traffic-millions@users.noreply.github.com>
d59061
Date: Tue, 3 Mar 2020 11:15:48 +0800
d59061
Subject: [PATCH 11/11] avahi_dns_packet_consume_uint32: fix potential
d59061
 undefined behavior
d59061
d59061
avahi_dns_packet_consume_uint32 left shifts uint8_t values by 8, 16 and 24 bits to combine them into a 32-bit value. This produces an undefined behavior warning with gcc -fsanitize when fed input values of 128 or 255 however in testing no actual unexpected behavior occurs in practice and the 32-bit uint32_t is always correctly produced as the final value is immediately stored into a uint32_t and the compiler appears to handle this "correctly".
d59061
d59061
Cast the intermediate values to uint32_t to prevent this warning and ensure the intended result is explicit.
d59061
d59061
Closes: #267
d59061
Closes: #268
d59061
Reference: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19304
d59061
---
d59061
 avahi-core/dns.c | 2 +-
d59061
 1 file changed, 1 insertion(+), 1 deletion(-)
d59061
d59061
diff --git a/avahi-core/dns.c b/avahi-core/dns.c
d59061
index 7c38f42..d793b76 100644
d59061
--- a/avahi-core/dns.c
d59061
+++ b/avahi-core/dns.c
d59061
@@ -455,7 +455,7 @@ int avahi_dns_packet_consume_uint32(AvahiDnsPacket *p, uint32_t *ret_v) {
d59061
         return -1;
d59061
 
d59061
     d = (uint8_t*) (AVAHI_DNS_PACKET_DATA(p) + p->rindex);
d59061
-    *ret_v = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
d59061
+    *ret_v = ((uint32_t)d[0] << 24) | ((uint32_t)d[1] << 16) | ((uint32_t)d[2] << 8) | (uint32_t)d[3];
d59061
     p->rindex += sizeof(uint32_t);
d59061
 
d59061
     return 0;
d59061
-- 
d59061
2.25.2
d59061