All the users of mf_vl_mff_mf_from_nxm_header() expect it to always obtain
a valid field or to report an error.  In practice, it did not report an
error in the case where the field was unknown (although it did report an
error in some other cases).  This commit fixes the problem.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9652
Signed-off-by: Ben Pfaff <b...@ovn.org>
---
 lib/meta-flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index fd8f3c6d85ea..b6d9e92b691d 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -3519,7 +3519,9 @@ mf_vl_mff_mf_from_nxm_header(uint32_t header,
                              uint64_t *tlv_bitmap)
 {
     *field = mf_from_nxm_header(header, vl_mff_map);
-    if (mf_vl_mff_invalid(*field, vl_mff_map)) {
+    if (!*field) {
+        return OFPERR_OFPBAC_BAD_SET_TYPE;
+    } else if (mf_vl_mff_invalid(*field, vl_mff_map)) {
         return OFPERR_NXFMFC_INVALID_TLV_FIELD;
     }
 
-- 
2.16.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to