Hello. I built protocol IEC104 on my ubuntu16.04 machine with AddressSanitizer(export CFLAGS="-g -fsanitize=address" CXXFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address"
before make) .
But when I use the following data ( here in hexadecimal format for easy understanding but must be inputted as binary format file ) as the input to the server TCP socket 10000
, there will be a SEGV during the running which is different from issue#5 and issue#6 .
Register "Linux" IEC104 Success, < HuiXing 2014-2015 > ...
mode :(0), port: (0), ip: (), station num: (1)
Iec104 Server Mode
Iec104 Socket Ok(10000) !
Iec104 Bind Ok(10000) !
Iec104 Listen Ok(10000)
feilong:Iec104 Listen Ok(10000)
feilong:Waiting for connection
Accept ok!
Server start get connect from 0 : 0x2328
#####################received
[DumpHEX]Length:260
68:00:68:00:68:00:68:0f 68:00:00:00:02:00:00:68
00:00:00:70:68:01:4e:68 0f:68:00:68:00:6e:21:00
68:00:00:68:7f:00:68:00 68:01:13:68:0f:68:00:68
00:80:01:0e:10:00:00:00 68:00:48:00:68:0f:68:00
68:00:80:00:00:68:00:00 00:70:68:01:70:68:0f:68
00:68:00:6e:21:00:68:00 00:68:68:00:68:00:68:01
13:68:0f:68:00:68:00:80 01:0e:10:00:68:00:68:00
68:00:68:0f:68:00:00:00 02:00:00:68:00:00:00:70
68:01:4e:68:0f:68:00:68 00:6e:21:00:68:00:00:68
7f:00:68:00:68:01:13:68 0f:68:00:68:00:80:01:0e
10:00:00:00:68:00:48:00 68:0f:83:00:68:00:80:00
00:68:00:00:00:70:68:01 70:68:0f:68:00:68:00:6e
21:00:68:00:00:68:68:00 68:00:68:01:13:68:0f:68
00:68:00:80:01:0e:10:00 00:00:68:00:48:00:68:10
68:00:82:00:80:01:0e:00 00:00:00:68:00:01:00:00
ff:68:00:82:00:80:01:ff 00:00:00:00:68:00:48:00
0e:10:00:00
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,0)
-Iec104_Deal_I-, error Type(104)
-Iex104_Receive-,Frame Type I
-Iec104_Deal_I-, error asdu addr(0)(2)
-Iex104_Receive-,Frame Type I
-Iec104_Deal_I-, error asdu addr(0)(6800)
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,0), Send(0,53)
-Iec104_Deal_SN-, error,send last(52),now(52). recv last(52),now(0)
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
-Iec104_Deal_I-, error Type(110)
-Iex104_Receive-,Frame Type U
>Iec104_Deal_U<, function STOPDT
IEC10X_Enqueue,Prio(0) elementNum(0)len(6)(6)
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
++++Asdu Type Firmware Update...
update flag error! need:1,flag:72
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
++++Asdu Type Firmware Update...
-Iec104_Deal_FirmUpdate-,data:28673,Len:17 error cot:
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
-Iec104_Deal_I-, error Type(110)
-Iex104_Receive-,Frame Type U
>Iec104_Deal_U<, function STOPDT
IEC10X_Enqueue,Prio(0) elementNum(1)len(6)(6)
-Iex104_Receive-,Frame Type I
-Iec104_Deal_I-, error asdu addr(0)(6800)
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,0), Send(0,53)
-Iec104_Deal_SN-, error,send last(52),now(52). recv last(52),now(0)
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
-Iec104_Deal_I-, error Type(110)
-Iex104_Receive-,Frame Type U
>Iec104_Deal_U<, function STOPDT
IEC10X_Enqueue,Prio(0) elementNum(2)len(6)(6)
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
++++Asdu Type Firmware Update...
update flag error! need:1,flag:72
-Iex104_Receive-,Frame Type U
>Iec104_Deal_U<, function TESTER ACK
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
-Iec104_Deal_I-, error Type(110)
-Iex104_Receive-,Frame Type U
>Iec104_Deal_U<, function STOPDT
IEC10X_Enqueue,Prio(0) elementNum(3)len(6)(6)
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,52), Send(0,53)
++++Asdu Type Firmware Update...
update flag error! need:1,flag:72
-Iex104_Receive-,Frame Type I
Receive Pakage I(52,65), Send(0,53)
++++Asdu Type Firmware Update...
-Iec104_Deal_FirmUpdate-,data:1,Len:0,seek:0
ASAN:SIGSEGV
=================================================================
==21865==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x7ffcd2c02ae0 sp 0x7ffcd2c028c8 T0)
==21865==Hint: pc points to the zero page.
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ??:0 ??
==21865==ABORTING
Thread 2 "iec104_monitor" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff37ff700 (LWP 21270)]
0x0000000000000000 in ?? ()
(gdb) backtrace
#0 0x0000000000000000 in ?? ()
#1 0x000000000040975b in Iec104_Deal_FirmUpdate (asdu=asdu@entry=0x7ffff37fe964, Len=Len@entry=18 '\022') at ../IEC10X/Iec104.c:1066
#2 0x000000000040a631 in Iec104_Deal_I (Iec104Data=Iec104Data@entry=0x7ffff37fe95e, len=len@entry=18) at ../IEC10X/Iec104.c:1208
#3 0x000000000040adac in Iex104_Receive (buf=buf@entry=0x7ffff37fe880 "h", len=len@entry=260) at ../IEC10X/Iec104.c:1305
#4 0x000000000040fe67 in Iec104_main (arg=<optimized out>) at main.c:138
#5 0x00007ffff6a306ba in start_thread (arg=0x7ffff37ff700) at pthread_create.c:333
#6 0x00007ffff676641d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb)
#0 0x0000000000000000 in ?? ()
#1 0x000000000040975b in Iec104_Deal_FirmUpdate (asdu=asdu@entry=0x7ffff37fe964, Len=Len@entry=18 '\022') at ../IEC10X/Iec104.c:1066
#2 0x000000000040a631 in Iec104_Deal_I (Iec104Data=Iec104Data@entry=0x7ffff37fe95e, len=len@entry=18) at ../IEC10X/Iec104.c:1208
#3 0x000000000040adac in Iex104_Receive (buf=buf@entry=0x7ffff37fe880 "h", len=len@entry=260) at ../IEC10X/Iec104.c:1305
#4 0x000000000040fe67 in Iec104_main (arg=<optimized out>) at main.c:138
#5 0x00007ffff6a306ba in start_thread (arg=0x7ffff37ff700) at pthread_create.c:333
#6 0x00007ffff676641d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb)