mkpro118 / Regex-Engine

Regex Engine in C
MIT License
0 stars 0 forks source link

Address overflow when creating test suite #48

Closed mkpro118 closed 2 months ago

mkpro118 commented 2 months ago

On a call to create_test_suite with valid arguments, there is a dereference of a high value address.

Compilation command: (x.c is a test file using the library)

gcc x.c tests.c asserts.c -I ../../include/ -Wall -Werror -Wextra -pedantic -fsanitize=address -fsanitize=undefined -g

Report from Address Sanitizer

tests.c:537:21: runtime error: pointer index expression with base 0x6040000000d0 overflowed to 0xf5f65635f5f5f6c0                   
AddressSanitizer:DEADLYSIGNAL                                                                                                       
=================================================================                                                                   
==109==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x55aa5d279546 bp 0x7ffd93df1ea0 sp 0x7ffd93df1e50 T0)                  
==109==The signal is caused by a READ memory access.                                                                                
==109==Hint: this fault was caused by a dereference of a high value address (see register values below).  Dissassemble the provided 
pc to learn which register was used.                                                                                                
    #0 0x55aa5d279546 in create_test_suite /c_test/tests/testlib/tests.c:537                                                        
    #1 0x55aa5d27568f in main /c_test/tests/testlib/x.c:23                                                                          
    #2 0x7fb5dc38bd8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)                                                                    
    #3 0x7fb5dc38be3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)                                                
    #4 0x55aa5d275424 in _start (/c_test/tests/testlib/a.out+0xa424)                                                                

AddressSanitizer can not provide additional info.                                                                                   
SUMMARY: AddressSanitizer: SEGV /c_test/tests/testlib/tests.c:537 in create_test_suite                                              
==109==ABORTING 
mkpro118 commented 2 months ago

I believe this was resolved in #47