Closed quadroli closed 5 days ago
Any assistance/guidance would be really appreciated as I believe this is not expected behaviour
Also, if I comment out either of the blocks i.e. I either use the write/node API, it works just fine, issue is if I try using both in the same file Is there something I could be missing ?
I tracked down the issue to tree and writer being uninitialised, So a work around would be adding
mpack_writer_t dummy_writer;
mpack_writer_t *writer = &dummy_writer;
and
mpack_tree_t dummy_tree;
mpack_tree_t *tree = &dummy_tree;
If it helps, I'm using Alpine Linux with Musl as the libc Compiler: clang18
So, Amazing library by the way, I love it, I was looking for a convenient way/format to read and write data from my app and this is well structured. However it appears that if
mpack_writer_init_filename()
is called, one can not later on callmpack_tree_init_filename()
even if opening two different files (fails for the same file as well), this has the implication that one can not read and write to the same file in the same program.To further elaborate, this code snippet segfaults upon encountering
mpack_tree_init_filename()
The backtrace shows:
0 memset () at src/string/x86_64/memset.s:55 1 0x00005555555fb4fb in __asan_memset () at /home/buildozer/aports/main/llvm-runtimes/src/llvm-project-18.1.8.src/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:67 2 0x000055555564d51c in mpack_tree_init_clear (tree=0x0) at mpack.c:5911 3 0x000055555564064d in mpack_tree_init_data (tree=0x0, data=0x502000000010 "\201\245theme\004", length=8) at mpack.c:5920 4 0x000055555564db78 in mpack_tree_init_stdfile_noclose (tree=0x0, stdfile=0x51a000000680, max_bytes=0) at mpack.c:6088 5 0x000055555564da26 in mpack_tree_init_stdfile (tree=0x0, stdfile=0x51a000000680, max_bytes=0, close_when_done=true) at mpack.c:6097 6 0x000055555564080d in mpack_tree_init_filename (tree=0x0, --Type