bethesirius / ChosunTruck

Euro Truck Simulator 2 autonomous driving solution
732 stars 104 forks source link

[linux] Buffer Overflow Detected #5

Closed zappybiby closed 7 years ago

zappybiby commented 7 years ago

When running "sudo ./auto_drive", a buffer overflow is detected:


==19523== Command: ./auto_drive
==19523== 
*** buffer overflow detected ***: ./auto_drive terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x89fa7e5]==19523== Command: ./auto_drive
==19523== 
*** buffer overflow detected ***: ./auto_drive terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x89fa7e5]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x8a9b56c]
/lib/x86_64-linux-gnu/libc.so.6(+0x116570)[0x8a99570]
/lib/x86_64-linux-gnu/libc.so.6(__strcat_chk+0x5d)[0x8a9887d]
./auto_drive[0x40797a]
./auto_drive[0x402863]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x89a3830]
./auto_drive[0x404189]

Valgrind Info:

Process terminating with default action of signal 6 (SIGABRT)
==19523==    at 0x89B8428: raise (raise.c:54)
==19523==    by 0x89BA029: abort (abort.c:89)
==19523==    by 0x89FA7E9: __libc_message (libc_fatal.c:175)
==19523==    by 0x8A9B56B: __fortify_fail (fortify_fail.c:37)
==19523==    by 0x8A9956F: __chk_fail (chk_fail.c:28)
==19523==    by 0x8A9887C: __strcat_chk (strcat_chk.c:34)
==19523==    by 0x407979: setPath(char*) (in /home/brian/Desktop/ChosunTruck/auto_drive)
==19523==    by 0x402862: main (in /home/brian/Desktop/ChosunTruck/auto_drive)
bethesirius commented 7 years ago

How many do you connect mouse device? You have to connect only 1 mouse device. If not this problem, I need more information about your environment. Please type cat /proc/bus/input/devices | grep mouse | awk '{print $3}' in your ternimal and give me the result. Thanks.

zappybiby commented 7 years ago
brian@brian-MS-7977:~/Desktop/ChosunTruck$ cat /proc/bus/input/devices | grep mouse | awk '{print $3}'
Peripherals
event6

I only have one mouse. I also have a dual monitor setup, I tried disabling one of the monitors but still get the same problem.

zappybiby commented 7 years ago

NOTE: I am talking about the Master version here.

Using Dr. Memory I found a similar buffer overflow error:

See the results.txt

I used a program called "Dr. Memory" to find the errors. Lines 144 and 149 are causing the buffer overflow for me.

bethesirius commented 7 years ago

I removed code that cause the problem. It does not find mouse device now. I changed the mouse input method in https://github.com/bethesirius/ChosunTruck/commit/dd02851dc2f411553d876d59cc2c13c043ac6b46. Pull and build from new commit. I think that it is better to create new issue for the overflow of the Windows branch.

zappybiby commented 7 years ago

Holy shit, It works!! You are the greatest!!! Thank you so much for your help!!!