mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: uninitialized variable
Date: Fri, 20 May 2016 22:44:36 +0200	[thread overview]
Message-ID: <20160520204436.GH22574@port70.net> (raw)
In-Reply-To: <e8f9f75f-9aef-e771-e6ad-4045e6fcbf1e@cs.utah.edu>

* 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


      reply	other threads:[~2016-05-20 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19 15:28 John Regehr
2016-05-20 20:44 ` Szabolcs Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160520204436.GH22574@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).