diff mbox series

[ovs-dev,v3,05/14] ovsdb-idlc: Avoid accessing member within NULL idl index cursors.

Message ID 20220124141817.11777.10339.stgit@dceara.remote.csb
State Accepted
Commit b9e8354d045adbe6784f199915b557674e0327f3
Headers show
Series Fix UndefinedBehaviorSanitizer reported issues and enable it in CI. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Dumitru Ceara Jan. 24, 2022, 2:18 p.m. UTC
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
      #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 <aconole@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
---
v3: Added Aaron's ack.
---
 ovsdb/ovsdb-idlc.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Valerio Feb. 3, 2022, 7:05 p.m. UTC | #1
Dumitru Ceara <dceara@redhat.com> writes:

> 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
>       #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 <aconole@redhat.com>
> Signed-off-by: Dumitru Ceara <dceara@redhat.com>
> ---

Acked-by: Paolo Valerio <pvalerio@redhat.com>
Ilya Maximets Feb. 15, 2022, 1:15 p.m. UTC | #2
On 2/3/22 20:05, Paolo Valerio wrote:
> Dumitru Ceara <dceara@redhat.com> writes:
> 
>> 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
>>       #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 <aconole@redhat.com>
>> Signed-off-by: Dumitru Ceara <dceara@redhat.com>
>> ---
> 
> Acked-by: Paolo Valerio <pvalerio@redhat.com>
> 

Thanks!  Applied and backported down to 2.13.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 5a02c8f936a0..10a70ae26f96 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -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 *