pellegre / libcrafter

A high level C++ network packet sniffing and crafting library.
298 stars 88 forks source link

Error with SetFieldValue #55

Open AcaDemIQ opened 6 years ago

AcaDemIQ commented 6 years ago

Hello, Program SafeQ Client used this library, and I've got Program received signal SIGSEGV, Segmentation fault. 0x0000000000405057 in void Crafter::Layer::SetFieldValue<unsigned short>(unsigned long, unsigned short) ()

#0  0x0000000000405057 in void Crafter::Layer::SetFieldValue<unsigned short>(unsigned long, unsigned short) ()
#1  0x00007ffff7bb78e7 in Crafter::ICMPv6Layer::SetCheckSum (value=<optimized out>, this=0x7fffffffc830) at crafter/Protocols/ICMPv6Layer.h:62
#2  Crafter::ICMPv6::ICMPv6 (this=0x7fffffffc830) at crafter/Protocols/ICMPv6Constructor.cpp:44
#3  0x00007ffff7b78abf in Crafter::InitCrafter () at crafter/InitCrafter.cpp:33
#4  0x00007ffff7b6c75a in Crafter::Protocol::Protocol (this=0x7ffff7dd6000 <Crafter::Protocol::ProtoFactory>) at crafter/Layer.h:376
#5  __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at crafter/Layer.cpp:39
#6  _GLOBAL__sub_I_Layer.cpp(void) () at crafter/Layer.cpp:483
#7  0x00007ffff7de76ba in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe658, env=env@entry=0x7fffffffe668) at dl-init.c:72
#8  0x00007ffff7de77cb in call_init (env=0x7fffffffe668, argv=0x7fffffffe658, argc=1, l=<optimized out>) at dl-init.c:30
#9  _dl_init (main_map=0x7ffff7ffe168, argc=1, argv=0x7fffffffe658, env=0x7fffffffe668) at dl-init.c:120
#10 0x00007ffff7dd7c6a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#11 0x0000000000000001 in ?? ()
#12 0x00007fffffffe870 in ?? ()
#13 0x0000000000000000 in ?? ()

I tried disable IPv6 object init in CraftInit.cpp, but this problem was also in IP object.

Where is the problem?

oliviertilmans commented 6 years ago

Hi,

I'll look into this ASAP. can you let me know the revision of libcrafter that you are using ? (i.e., the output of git rev-parse HEAD)

oliviertilmans commented 6 years ago

Beside the git revision you are using, could you describe how you came to that particular stack trace ? Maybe provide some example to reproduce it ?

Thanks

AcaDemIQ commented 6 years ago

It's work with CentOS, but not in Ubuntu/Linux Mint. Version of Libcrafter is 0.0.2, but problem with all versions.

Thanks, Aleksey.

AcaDemIQ commented 6 years ago

I compiled library ver. 0.3.

oliviertilmans commented 6 years ago

I compiled library ver. 0.3.

Do you mean the latest git master revision or the last tag?

Could you describe what you are doing when getting this crash? I.e. what are those call_init() functions? Are you calling InitCrafter() multiple times?

AcaDemIQ commented 6 years ago

Year, I use last tag. I just used SafeQ Client on Ubuntu system, but I haven't any problems with CentOS system + libcrafter.

oliviertilmans commented 6 years ago

Could you try the latest master revision ? 0.2/0.3 are several years old, and sadly the backtrace you provided not particularly helpful. Do you know how SafeQ client uses libcrafter?