Shifting a 16-bit signed int 16 bits is technically undefined behavior. This fixes the problem. (In practice this should be harmless in this case.)
Reported-at; https://oss-fuzz.com/v2/testcase-detail/4730143510626304 Signed-off-by: Ben Pfaff <[email protected]> --- build-aux/extract-ofp-errors | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors index 6c14f68b883a..6f64efd2069d 100755 --- a/build-aux/extract-ofp-errors +++ b/build-aux/extract-ofp-errors @@ -391,7 +391,7 @@ static const char *error_comments[OFPERR_N_ERRORS] = { static enum ofperr %s_decode(uint32_t vendor, uint16_t type, uint16_t code) { - switch (((uint64_t) vendor << 32) | (uint32_t) (type << 16) | code) {""" + switch (((uint64_t) vendor << 32) | ((uint32_t) type << 16) | code) {""" % name) found = set() for enum in names: @@ -406,7 +406,7 @@ static enum ofperr vendor_s = "(%#xULL << 32) | " % vendor else: vendor_s = "" - print (" case %s(uint32_t) (%d << 16) | %d:" % (vendor_s, + print (" case %s ((uint32_t) %d << 16) | %d:" % (vendor_s, type_, code)) print (" return OFPERR_%s;" % enum) print ("""\ -- 2.16.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
