Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 20 May 2016 22:44:36 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: uninitialized variable

* John Regehr <regehr@...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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.