Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upHeap-based buffer overflow in check_literal() #995
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dtolnay
Oct 18, 2015
Collaborator
Interesting, that exact line is commented // FIXME: invalid, and the previous line is // FIXME: better parser. I am not familiar with this part of the code but it looks like it is adding a null character onto the end of the current token in order to call dtoa, without making room for it in the buffer. Definitely needs to be fixed.
From the Debian ticket, the AFL input was:
[0,true,false,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
Interesting, that exact line is commented From the Debian ticket, the AFL input was:
|
dtolnay
added
the
bug
label
Oct 18, 2015
nicowilliams
self-assigned this
Oct 24, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nicowilliams
Oct 24, 2015
Collaborator
Good catch! That FIXME comment and this bug go back a long time. The bug is an off by one around resizing the token buffer.
I'm currently testing this fix:
diff --git a/src/jv_parse.c b/src/jv_parse.c
index 3102ed4..b9b6348 100644
--- a/src/jv_parse.c
+++ b/src/jv_parse.c
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) {
static void tokenadd(struct jv_parser* p, char c) {
assert(p->tokenpos <= p->tokenlen);
- if (p->tokenpos == p->tokenlen) {
+ if (p->tokenpos >= (p->tokenlen - 1)) {
p->tokenlen = p->tokenlen*2 + 256;
p->tokenbuf = jv_mem_realloc(p->tokenbuf, p->tokenlen);
}
|
Good catch! That FIXME comment and this bug go back a long time. The bug is an off by one around resizing the token buffer. I'm currently testing this fix:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Fixed with 8eb1367. |
nicowilliams
closed this
Oct 24, 2015
nicowilliams
added
the
security
label
Oct 24, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dolmen
commented
May 18, 2016
|
This issue is referenced as CVE-2015-8863. |
else commentedOct 18, 2015
On Sun, Oct 18, 2015, at 18:02, Jakub Wilk wrote:
see https://bugs.debian.org/802231