diff options
author | Ben Pfaff <blp@ovn.org> | 2018-06-23 10:29:27 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-07-05 15:08:20 -0700 |
commit | 1ab2425cbeaf755868603fa0db03632146725855 (patch) | |
tree | e809467f32c4f029b6c2047606b2941f8f51f873 /build-aux/extract-ofp-errors | |
parent | f1a57715f9893b9a64f71eb8dfb32bfe51625798 (diff) | |
download | openvswitch-1ab2425cbeaf755868603fa0db03632146725855.tar.gz |
extract-ofp-errors: Fix undefined behavior shifting 'int' 16 places left.
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 <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'build-aux/extract-ofp-errors')
-rwxr-xr-x | build-aux/extract-ofp-errors | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/build-aux/extract-ofp-errors b/build-aux/extract-ofp-errors index 6c14f68b8..6f64efd20 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 ("""\ |