Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Irange tests #2

Closed
wants to merge 2 commits into from
Closed

Irange tests #2

wants to merge 2 commits into from

Conversation

tcanabrava
Copy link
Contributor

The int nodes are missing some tests: the Timeout on the int/buffer and the int/constrain nodes. this patch adds them.

simple test for int/buffer timeout port.
Simple test for the int/constrain node.
@tcanabrava
Copy link
Contributor Author

Closing this one because I just send a v2

@tcanabrava tcanabrava closed this Jun 18, 2015
@tcanabrava tcanabrava deleted the irange_tests branch June 18, 2015 22:42
bdilly referenced this pull request in ricdevz/soletta Jul 14, 2015
Duktape[1] is an embeddable Javascript engine, with focus on
portabillity and compact footprint.

As suggested by the guide, duktape instalation is done by
adding C source and header to the build.

We're adding this in the thirdparty directory, in order to use
it in the next commit, where soletta meets js node.

[1] - http://duktape.org / https://github.com/svaarala/duktape

Signed-off-by: Ricardo de Almeida Gonzaga <ricardo.gonzaga@intel.com>
@lgywata lgywata mentioned this pull request Sep 1, 2015
otaviobp pushed a commit to otaviobp/soletta that referenced this pull request Nov 27, 2015
As device_id is a fixed size string, we don't even need to allocate it
in the heap

One way to check this bahaviour is running the light-server +
light-scan/light-client-scan sample located in src/samples/flow/oic/.
Use client scan to connect to different servers. Do it several times.
After that closes the client.

Leak information from compiler sanitizer:

Direct leak of 64 byte(s) in 4 object(s) allocated from:
    #0 0x7fd5bbecf93a in __interceptor_malloc /build/gcc-multilib/src/gcc-5.2.0/libsanitizer/asan/asan_malloc_linux.cc:38
    solettaproject#1 0x7fd59dfa0a29 in hex_ascii_to_binary (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8a29)
    solettaproject#2 0x7fd59dfa0bed in client_connect (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8bed)
    solettaproject#3 0x7fd59dfa32df in device_id_process (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0xb2df)
    solettaproject#4 0x7fd5bb51b2ca in dispatch_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a42ca)
    solettaproject#5 0x7fd5bb51d282 in flow_send_do (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a6282)
    solettaproject#6 0x7fd5bb51d7e1 in flow_send_idle (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a67e1)
    solettaproject#7 0x7fd5bb494a46 in sol_mainloop_common_timeout_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11da46)
    solettaproject#8 0x7fd5bb499244 in sol_mainloop_impl_iter (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122244)
    solettaproject#9 0x7fd5bb496022 in sol_mainloop_impl_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11f022)
    solettaproject#10 0x7fd5bb499b74 in sol_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122b74)
    solettaproject#11 0x403a7a in main (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403a7a)
    solettaproject#12 0x7fd5b7df360f in __libc_start_main (/usr/lib/libc.so.6+0x2060f)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7fd5bbecf93a in __interceptor_malloc /build/gcc-multilib/src/gcc-5.2.0/libsanitizer/asan/asan_malloc_linux.cc:38
    solettaproject#1 0x7fd59dfa0a29 in hex_ascii_to_binary (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8a29)
    solettaproject#2 0x7fd59dfa0bed in client_connect (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8bed)
    solettaproject#3 0x7fd59dfa32df in device_id_process (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0xb2df)
    solettaproject#4 0x7fd5bb51b2ca in dispatch_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a42ca)
    solettaproject#5 0x7fd5bb51d282 in flow_send_do (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a6282)
    solettaproject#6 0x7fd5bb51d7e1 in flow_send_idle (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a67e1)
    solettaproject#7 0x7fd5bb494a46 in sol_mainloop_common_timeout_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11da46)
    solettaproject#8 0x7fd5bb494e13 in sol_mainloop_common_idler_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11de13)
    solettaproject#9 0x7fd5bb499258 in sol_mainloop_impl_iter (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122258)
    solettaproject#10 0x7fd5bb496022 in sol_mainloop_impl_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11f022)
    solettaproject#11 0x7fd5bb499b74 in sol_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122b74)
    solettaproject#12 0x403a7a in main (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403a7a)
    solettaproject#13 0x7fd5b7df360f in __libc_start_main (/usr/lib/libc.so.6+0x2060f)

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
otaviobp pushed a commit that referenced this pull request Dec 2, 2015
As device_id is a fixed size string, we don't even need to allocate it
in the heap

One way to check this bahaviour is running the light-server +
light-scan/light-client-scan sample located in src/samples/flow/oic/.
Use client scan to connect to different servers. Do it several times.
After that closes the client.

Leak information from compiler sanitizer:

Direct leak of 64 byte(s) in 4 object(s) allocated from:
    #0 0x7fd5bbecf93a in __interceptor_malloc /build/gcc-multilib/src/gcc-5.2.0/libsanitizer/asan/asan_malloc_linux.cc:38
    #1 0x7fd59dfa0a29 in hex_ascii_to_binary (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8a29)
    #2 0x7fd59dfa0bed in client_connect (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8bed)
    #3 0x7fd59dfa32df in device_id_process (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0xb2df)
    #4 0x7fd5bb51b2ca in dispatch_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a42ca)
    #5 0x7fd5bb51d282 in flow_send_do (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a6282)
    #6 0x7fd5bb51d7e1 in flow_send_idle (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a67e1)
    #7 0x7fd5bb494a46 in sol_mainloop_common_timeout_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11da46)
    #8 0x7fd5bb499244 in sol_mainloop_impl_iter (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122244)
    #9 0x7fd5bb496022 in sol_mainloop_impl_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11f022)
    #10 0x7fd5bb499b74 in sol_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122b74)
    #11 0x403a7a in main (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403a7a)
    #12 0x7fd5b7df360f in __libc_start_main (/usr/lib/libc.so.6+0x2060f)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7fd5bbecf93a in __interceptor_malloc /build/gcc-multilib/src/gcc-5.2.0/libsanitizer/asan/asan_malloc_linux.cc:38
    #1 0x7fd59dfa0a29 in hex_ascii_to_binary (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8a29)
    #2 0x7fd59dfa0bed in client_connect (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0x8bed)
    #3 0x7fd59dfa32df in device_id_process (//home/otavio/local/soletta/lib/soletta/modules//flow//oic.so+0xb2df)
    #4 0x7fd5bb51b2ca in dispatch_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a42ca)
    #5 0x7fd5bb51d282 in flow_send_do (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a6282)
    #6 0x7fd5bb51d7e1 in flow_send_idle (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a67e1)
    #7 0x7fd5bb494a46 in sol_mainloop_common_timeout_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11da46)
    #8 0x7fd5bb494e13 in sol_mainloop_common_idler_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11de13)
    #9 0x7fd5bb499258 in sol_mainloop_impl_iter (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122258)
    #10 0x7fd5bb496022 in sol_mainloop_impl_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x11f022)
    #11 0x7fd5bb499b74 in sol_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x122b74)
    #12 0x403a7a in main (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403a7a)
    #13 0x7fd5b7df360f in __libc_start_main (/usr/lib/libc.so.6+0x2060f)

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
otaviobp pushed a commit to otaviobp/soletta that referenced this pull request Dec 16, 2015
Inspector was accessing invalid memory area and printing int and float
values, because they are now a single number instead of an irange or
drange.
Also adding debug for the new option types irange-spec and drange-spec.

Error following:
=================================================================
==23290==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000310d4 at pc 0x00000040948a bp 0x7ffee0aa9b40 sp 0x7ffee0aa9b30
READ of size 4 at 0x6030000310d4 thread T0
    #0 0x409489 in inspector_did_open_node (/home/otavio/local/soletta/bin/sol-fbp-runner+0x409489)

0x6030000310d4 is located 0 bytes to the right of 20-byte region [0x6030000310c0,0x6030000310d4)
allocated by thread T0 here:
    #0 0x7f84e859aad9 in __interceptor_calloc /build/gcc-multilib/src/gcc-5.3.0/libsanitizer/asan/asan_malloc_linux.cc:54
    solettaproject#1 0x7f84e7bcb9b0 in sol_flow_node_options_new (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1989b0)
    solettaproject#2 0x7f84e7bd5fc9 in build_node (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a2fc9)
    solettaproject#3 0x7f84e7bd75a3 in build_flow (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a45a3)
    solettaproject#4 0x7f84e7bd8796 in sol_flow_parse_buffer (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a5796)
    solettaproject#5 0x40622e in runner_new_from_file (/home/otavio/local/soletta/bin/sol-fbp-runner+0x40622e)
    solettaproject#6 0x403083 in startup (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403083)
    solettaproject#7 0x7f84e7b565c2 in sol_mainloop_common_idler_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1235c2)
    solettaproject#8 0x7f84e7b5aa76 in sol_mainloop_impl_iter (/home/otavio/local/soletta/lib/libsoletta.so.0+0x127a76)
    solettaproject#9 0x7f84e7b57840 in sol_mainloop_impl_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x124840)
    solettaproject#10 0x7f84e7b5b3a7 in sol_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1283a7)
    solettaproject#11 0x403a7a in main (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403a7a)
    solettaproject#12 0x7f84e44ad60f in __libc_start_main (/usr/lib/libc.so.6+0x2060f)

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
otaviobp pushed a commit that referenced this pull request Dec 17, 2015
Inspector was accessing invalid memory area and printing int and float
values, because they are now a single number instead of an irange or
drange.
Also adding debug for the new option types irange-spec and drange-spec.

Error following:
=================================================================
==23290==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000310d4 at pc 0x00000040948a bp 0x7ffee0aa9b40 sp 0x7ffee0aa9b30
READ of size 4 at 0x6030000310d4 thread T0
    #0 0x409489 in inspector_did_open_node (/home/otavio/local/soletta/bin/sol-fbp-runner+0x409489)

0x6030000310d4 is located 0 bytes to the right of 20-byte region [0x6030000310c0,0x6030000310d4)
allocated by thread T0 here:
    #0 0x7f84e859aad9 in __interceptor_calloc /build/gcc-multilib/src/gcc-5.3.0/libsanitizer/asan/asan_malloc_linux.cc:54
    #1 0x7f84e7bcb9b0 in sol_flow_node_options_new (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1989b0)
    #2 0x7f84e7bd5fc9 in build_node (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a2fc9)
    #3 0x7f84e7bd75a3 in build_flow (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a45a3)
    #4 0x7f84e7bd8796 in sol_flow_parse_buffer (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1a5796)
    #5 0x40622e in runner_new_from_file (/home/otavio/local/soletta/bin/sol-fbp-runner+0x40622e)
    #6 0x403083 in startup (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403083)
    #7 0x7f84e7b565c2 in sol_mainloop_common_idler_process (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1235c2)
    #8 0x7f84e7b5aa76 in sol_mainloop_impl_iter (/home/otavio/local/soletta/lib/libsoletta.so.0+0x127a76)
    #9 0x7f84e7b57840 in sol_mainloop_impl_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x124840)
    #10 0x7f84e7b5b3a7 in sol_run (/home/otavio/local/soletta/lib/libsoletta.so.0+0x1283a7)
    #11 0x403a7a in main (/home/otavio/local/soletta/bin/sol-fbp-runner+0x403a7a)
    #12 0x7f84e44ad60f in __libc_start_main (/usr/lib/libc.so.6+0x2060f)

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
otaviobp pushed a commit that referenced this pull request Jun 1, 2016
If packet is referenced using sol_coap_packet_ref we can't free its
content before last unref is called. Using coap_packet_free instead of
sol_coap_unref in on_can_read function was causing a double free when
last unref was called.

Stacktrace of the problem:

 ==17046==ERROR: AddressSanitizer: heap-use-after-free on address
 0x60400000d4d0 at pc 0x7fc2c340457b bp 0x7ffd0c34f850 sp 0x7ffd0c34f840
 READ of size 4 at 0x60400000d4d0 thread T0
 #0 0x7fc2c340457a in sol_coap_packet_unref src/lib/comms/sol-coap.c:507

 0x60400000d4d0 is located 0 bytes inside of 48-byte region
 [0x60400000d4d0,0x60400000d500)
 freed by thread T0 here:
 #0 0x7fc2c3c2ea20 in __interceptor_free
 /build/gcc-multilib/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:28
 #1 0x7fc2c34044e9 in coap_packet_free src/lib/comms/sol-coap.c:499
 #2 0x7fc2c340baa0 in on_can_read src/lib/comms/sol-coap.c:1662
 #3 0x7fc2c347741b in on_socket_event
 src/lib/comms/sol-socket-impl-linux.c:52
 #4 0x7fc2c33da836 in fd_process
 src/lib/common/sol-mainloop-impl-posix.c:702
 #5 0x7fc2c33da9e1 in sol_mainloop_impl_iter
 src/lib/common/sol-mainloop-impl-posix.c:729
 #6 0x7fc2c33d77e2 in sol_mainloop_impl_run
 src/lib/common/sol-mainloop-common.c:544
 #7 0x7fc2c33db481 in sol_run src/lib/common/sol-mainloop.c:264
 #8 0x7fc2c33dc969 in sol_mainloop_default_main
 src/lib/common/sol-mainloop.c:558
 #9 0x55b961a3c5ff in main src/samples/coap/oic-server.c:61
 #10 0x7fc2bf527740 in __libc_start_main (/usr/lib/libc.so.6+0x20740)

 previously allocated by thread T0 here:
 #0 0x7fc2c3c2ef10 in __interceptor_calloc
 /build/gcc-multilib/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:54
 #1 0x7fc2c34045c6 in packet_new src/lib/comms/sol-coap.c:521
 #2 0x7fc2c3404aec in sol_coap_packet_new src/lib/comms/sol-coap.c:553
 #3 0x7fc2c340b6d2 in on_can_read src/lib/comms/sol-coap.c:1633
 #4 0x7fc2c347741b in on_socket_event
 src/lib/comms/sol-socket-impl-linux.c:52
 #5 0x7fc2c33da836 in fd_process
 src/lib/common/sol-mainloop-impl-posix.c:702
 #6 0x7fc2c33da9e1 in sol_mainloop_impl_iter
 src/lib/common/sol-mainloop-impl-posix.c:729
 #7 0x7fc2c33d77e2 in sol_mainloop_impl_run
 src/lib/common/sol-mainloop-common.c:544
 #8 0x7fc2c33db481 in sol_run src/lib/common/sol-mainloop.c:264
 #9 0x7fc2c33dc969 in sol_mainloop_default_main
 src/lib/common/sol-mainloop.c:558
 #10 0x55b961a3c5ff in main src/samples/coap/oic-server.c:61
 #11 0x7fc2bf527740 in __libc_start_main (/usr/lib/libc.so.6+0x20740)

 SUMMARY: AddressSanitizer: heap-use-after-free
 src/lib/comms/sol-coap.c:507 in sol_coap_packet_unref

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant