Skip to content

Buildsystem#9

Merged
thiagomacieira merged 4 commits intointel:masterfrom
thiagomacieira:buildsystem
Sep 17, 2015
Merged

Buildsystem#9
thiagomacieira merged 4 commits intointel:masterfrom
thiagomacieira:buildsystem

Conversation

@thiagomacieira
Copy link
Member

Add a buildsystem to tinycbor

@thiagomacieira
Copy link
Member Author

@erichkeane, @lpereira, what do you think?

@thiagomacieira
Copy link
Member Author

@barbieri

@barbieri
Copy link

lgtm

The top-level Makefile will build the library, the cbordump tool and possibly
install them. Along with the buildsystem, tinycbor also gets a pkgconfig file
and a version number.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
We then avoid recompiling every time. Exceptions:
 - tst_parser requires a recursion limit set
 - tst_cpp #includes so that the sources are compiled as C++

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Release steps:
 1) run distcheck
 2) update the version number && commit it
 3) create a new tag
 4) create the release files

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Don't include .gitignore and .gitattributes itself, but do include the
SHA-1 of the commit in the .tag file.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
@thiagomacieira thiagomacieira merged commit b2a7f3e into intel:master Sep 17, 2015
@thiagomacieira thiagomacieira deleted the buildsystem branch September 21, 2015 18:04
thiagomacieira added a commit that referenced this pull request Sep 30, 2015
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
niooss-ledger added a commit to niooss-ledger/tinycbor that referenced this pull request Mar 13, 2025
When function text_string_to_escaped successfully parses a string and
fails to parse the next value (cbor_value_finish_string_iteration
returns an error), it correctly propagates the error but the string is
never freed.

This can be reproduced with:

    make CC='clang -g -fsanitize=address'
    printf '\x82\x60\xff' | ./bin/cbordump -j

clang's Address Sanitizer reports:

    =================================================================
    ==20317==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 1 byte(s) in 1 object(s) allocated from:
        #0 0x560b654b9916 in __interceptor_realloc (/tinycbor/bin/cbordump+0xa4916) (BuildId: f9933666b5d987b21f68c2887de4aebe93bc2bef)
        intel#1 0x560b654f5c18 in escape_text_string /tinycbor/src/cbortojson.c:331:15
        intel#2 0x560b654f3e29 in text_string_to_escaped /tinycbor/src/cbortojson.c:377:19
        intel#3 0x560b654f267d in value_to_json /tinycbor/src/cbortojson.c:674:19
        intel#4 0x560b654f34c2 in array_to_json /tinycbor/src/cbortojson.c:545:25
        intel#5 0x560b654f2085 in value_to_json /tinycbor/src/cbortojson.c:627:19
        intel#6 0x560b654f1baf in cbor_value_to_json_advance /tinycbor/src/cbortojson.c:816:12
        intel#7 0x560b654ea928 in dumpFile /tinycbor/tools/cbordump/cbordump.c:76:19
        intel#8 0x560b654ead2b in main /tinycbor/tools/cbordump/cbordump.c:149:9
        intel#9 0x7fa9d7629d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

    SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).

Fix this by freeing the string when cbor_value_finish_string_iteration
fails.

Fixes: e072bc1 ("CBOR-to-JSON: do properly escape JSON strings")
thiagomacieira pushed a commit that referenced this pull request Mar 14, 2025
When function text_string_to_escaped successfully parses a string and
fails to parse the next value (cbor_value_finish_string_iteration
returns an error), it correctly propagates the error but the string is
never freed.

This can be reproduced with:

    make CC='clang -g -fsanitize=address'
    printf '\x82\x60\xff' | ./bin/cbordump -j

clang's Address Sanitizer reports:

    =================================================================
    ==20317==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 1 byte(s) in 1 object(s) allocated from:
        #0 0x560b654b9916 in __interceptor_realloc (/tinycbor/bin/cbordump+0xa4916) (BuildId: f9933666b5d987b21f68c2887de4aebe93bc2bef)
        #1 0x560b654f5c18 in escape_text_string /tinycbor/src/cbortojson.c:331:15
        #2 0x560b654f3e29 in text_string_to_escaped /tinycbor/src/cbortojson.c:377:19
        #3 0x560b654f267d in value_to_json /tinycbor/src/cbortojson.c:674:19
        #4 0x560b654f34c2 in array_to_json /tinycbor/src/cbortojson.c:545:25
        #5 0x560b654f2085 in value_to_json /tinycbor/src/cbortojson.c:627:19
        #6 0x560b654f1baf in cbor_value_to_json_advance /tinycbor/src/cbortojson.c:816:12
        #7 0x560b654ea928 in dumpFile /tinycbor/tools/cbordump/cbordump.c:76:19
        #8 0x560b654ead2b in main /tinycbor/tools/cbordump/cbordump.c:149:9
        #9 0x7fa9d7629d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

    SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).

Fix this by freeing the string when cbor_value_finish_string_iteration
fails.

Fixes: e072bc1 ("CBOR-to-JSON: do properly escape JSON strings")
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

Successfully merging this pull request may close these issues.

2 participants