Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A SEGV bug in function Iec104_Deal_I #12

Open
NiceJob171 opened this issue Jul 12, 2019 · 0 comments
Open

A SEGV bug in function Iec104_Deal_I #12

NiceJob171 opened this issue Jul 12, 2019 · 0 comments

Comments

@NiceJob171
Copy link

NiceJob171 commented Jul 12, 2019

Hello. I built this protocol IEC104 on my ubuntu16.04 machine.
The command line to build the project is:
Use GCC to build:
cd ./test && make

And I use prenny desock tool to redirect TCP socket communication to the console. I save the preeny source code in the initial project and the project which includes preeny can by found at this address.
The command to build preeny is :
cd ./preeny && make

But when I use the following file as the input file to test the iec104_monitor on the server mode. The monitor will result in crash. This file can be found at this address.

The command line is as following:
LD_PRELOAD=./preeny/x86_64-linux-gnu/desock.so ./test/iec104_monitor -m server -n 1 < ./crash/crash_input_1
where ./preeny/x86_64-linux-gnu/desock.so is the library of preeny desock.

So the commands to touch the crash from the very beginning is:

git clone https://github.com/NiceJob171/IEC104.git
cd ./IEC104
cd ./test  && make
cd ..
cd ./preeny && make
cd ..
LD_PRELOAD=./preeny/x86_64-linux-gnu/desock.so ./test/iec104_monitor -m server -n 1 < ./crash/crash_input_1

This crash is a SEGV crash in fucntion Iec104_Deal_I and the crash line is at ../IEC10X/Iec104.c:1214.

I use gdb to debug it and the crash information is as following:

[DumpHEX]Length:6 
68:04:43:00:02:21
Send Ok!
hC!IEC10X_Enqueue,Prio(0) elementNum(0)len(6)(6) 
Tester Count(2)... 
Thread 2 "iec104_monitor" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff37ff700 (LWP 42308)]
0x0000000000000000 in ?? ()
(gdb) backtrace
#0  0x0000000000000000 in ?? ()
#1  0x000000000040a605 in Iec104_Deal_I (Iec104Data=Iec104Data@entry=0x7ffff37fe880, len=len@entry=137) at ../IEC10X/Iec104.c:1214
#2  0x000000000040adac in Iex104_Receive (buf=buf@entry=0x7ffff37fe880 "h\207", len=len@entry=8) at ../IEC10X/Iec104.c:1305
#3  0x000000000040fe67 in Iec104_main (arg=<optimized out>) at main.c:138
#4  0x00007ffff6a306ba in start_thread (arg=0x7ffff37ff700) at pthread_create.c:333
#5  0x00007ffff676641d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant