steve132 / ubj Goto Github PK
View Code? Open in Web Editor NEWUBJSON C/C++ libraries
License: MIT License
UBJSON C/C++ libraries
License: MIT License
When using negative lengths for strings there is a crash. There seems to be no validation on the string length or the result of malloc, so negative or huge values can result in a crash.
Minimal example program:
#include "stdio.h"
#include "ubj.h"
#include "ubjr.c"
int main()
{
char test[258] = {'S', 'i', -1, 't'};
for (int i = 3; i < 258; ++i)
{
test[i] = 't';
}
ubjr_context_t *ctx = ubjr_open_memory((const uint8_t *)test, (const uint8_t *)(test + sizeof(test)));
ubjr_dynamic_t value = ubjr_read_dynamic(ctx);
if (value.type == UBJ_STRING)
{
printf("%s\n", value.string);
}
else
{
printf("ERROR\n");
}
ubjr_cleanup_dynamic(&value);
ubjr_close_context(ctx);
return 0;
}
inline min function (line 556
) is used previously on line 277
. Moving the declaration to the top solves the issue.
ubj/ubjw.c:556:22: error: conflicting types for ‘min’
static inline size_t min(size_t x,size_t y)
^
ubj/ubjw.c:277:6: note: previous implicit declaration of ‘min’ was here
n = min(n, DISASSEMBLY_PRINT_BUFFER_SIZE);
^
tools/CMakeFiles/ubjdump.dir/build.make:123: recipe for target 'tools/CMakeFiles/ubjdump.dir/__/ubjw.c.o' failed
the call of ubjr_object_lookup() has problem inside
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.