* uninitialized variable
@ 2016-05-19 15:28 John Regehr
2016-05-20 20:44 ` Szabolcs Nagy
0 siblings, 1 reply; 2+ messages in thread
From: John Regehr @ 2016-05-19 15:28 UTC (permalink / raw)
To: musl
This call:
regcomp(&r, "^(b+|||(CW*)*|){5,}{53}*+)^?5,}", REG_EXTENDED);
ends up using uninitialized memory like so:
regcomp.c:221:[kernel] warning: accessing uninitialized left-value:
assert \initialized(&right->num_submatches);
stack: tre_ast_new_catenation :: regcomp.c:1764 <-
tre_copy_ast :: regcomp.c:1916 <-
tre_expand_ast :: regcomp.c:2771 <-
musl_regcomp :: foo.c:9 <-
main
Having crap in this field seems bad since it is used to compute a malloc
size.
John
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: uninitialized variable
2016-05-19 15:28 uninitialized variable John Regehr
@ 2016-05-20 20:44 ` Szabolcs Nagy
0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2016-05-20 20:44 UTC (permalink / raw)
To: musl
* John Regehr <regehr@cs.utah.edu> [2016-05-19 17:28:58 +0200]:
> This call:
>
> regcomp(&r, "^(b+|||(CW*)*|){5,}{53}*+)^?5,}", REG_EXTENDED);
>
> ends up using uninitialized memory like so:
>
> regcomp.c:221:[kernel] warning: accessing uninitialized left-value:
> assert \initialized(&right->num_submatches);
> stack: tre_ast_new_catenation :: regcomp.c:1764 <-
> tre_copy_ast :: regcomp.c:1916 <-
> tre_expand_ast :: regcomp.c:2771 <-
> musl_regcomp :: foo.c:9 <-
> main
thanks
it seems tre_add_tag* allocates a node
without initializing this field.
(nodes are supposed to be allocated by
dedicated functions based on node type,
those do the init.)
it seems this is wrong in the original tre
code too.
the ere "(a){2,}" should touch that code path.
i guess the right fix is to set the field
to 0, but i will have to look at the logic
more.
>
> Having crap in this field seems bad since it is used to compute a malloc
> size.
>
> John
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-20 20:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 15:28 uninitialized variable John Regehr
2016-05-20 20:44 ` Szabolcs Nagy
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).