[ovs-dev] [PATCH] ofctl_parse_target: Avoid passing invalid ofputil_protocol to ofputil_protocol_to_ofp_version

Yifeng Sun pkusunyifeng at gmail.com
Wed Nov 7 20:42:16 UTC 2018


In this test, the involved ovs functions expect valid ofputil_protocol
values. Therefore, if usable_protocols is invalid, we should return.
Otherwise, ovs will abort.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11165
Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
---
 tests/oss-fuzz/ofctl_parse_target.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/oss-fuzz/ofctl_parse_target.c b/tests/oss-fuzz/ofctl_parse_target.c
index fbd91bdd3e81..db86c7da1ab3 100644
--- a/tests/oss-fuzz/ofctl_parse_target.c
+++ b/tests/oss-fuzz/ofctl_parse_target.c
@@ -22,6 +22,7 @@ ofctl_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms,
 
     if (!(usable_protocols & OFPUTIL_P_ANY)) {
         printf("no usable protocol\n");
+        return;
     }
     for (i = 0; i < sizeof(enum ofputil_protocol) * CHAR_BIT; i++) {
         protocol = 1u << i;
-- 
2.7.4



More information about the dev mailing list