Skip to content

Commit

Permalink
ovsdb-idlc: Avoid accessing member within NULL idl index cursors.
Browse files Browse the repository at this point in the history
Reported by UndefinedBehaviorSanitizer:
  tests/idltest.c:3602:12:
        runtime error: member access within null pointer of type
                       'const struct idltest_simple'
      #0 0x4295af in idltest_simple_cursor_first_ge tests/idltest.c:3602
      #1 0x41c81b in test_idl_compound_index_single_column tests/test-ovsdb.c:3128
      #2 0x41e035 in do_idl_compound_index tests/test-ovsdb.c:3277
      #3 0x4cf640 in ovs_cmdl_run_command__ lib/command-line.c:247
      #4 0x4cf79f in ovs_cmdl_run_command lib/command-line.c:278
      #5 0x4072f7 in main tests/test-ovsdb.c:79
      openvswitch#6 0x7fa858675b74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
      #7 0x4060ed in _start (/root/ovs/tests/test-ovsdb+0x4060ed)

Acked-by: Aaron Conole <[email protected]>
Signed-off-by: Dumitru Ceara <[email protected]>
Acked-by: Paolo Valerio <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
dceara authored and igsilya committed Feb 14, 2022
1 parent b07c2e9 commit b9e8354
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ovsdb/ovsdb-idlc.in
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ struct ovsdb_idl_cursor
struct ovsdb_idl_index *index, const struct %(s)s *target)
{
ovs_assert(index->table->class_ == &%(p)stable_%(tl)s);
return ovsdb_idl_cursor_first_ge(index, &target->header_);
return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
}

struct %(s)s *
Expand Down

0 comments on commit b9e8354

Please sign in to comment.