mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Results of static analysis with clang static analyser
Date: Wed, 23 Sep 2015 22:11:32 +0200	[thread overview]
Message-ID: <20150923201131.GF10551@port70.net> (raw)
In-Reply-To: <D28EA11E-B6E9-4C71-9110-9EE6B93DC71E@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

* Khem Raj <raj.khem@gmail.com> [2015-09-22 22:58:55 -0700]:
> I have run scan-build on musl-git and here are results
> 
> http://busybox.net/~kraj/scan-build-2015-09-22-224330-15962-1/
> 

http://busybox.net/~kraj/scan-build-2015-09-22-224330-15962-1/report-321c4e.html#EndPath

this one is real, status can be REG_ESPACE (meaning oom).

the rest seem ok or benign.

[-- Attachment #2: 0001-regcomp-propagate-allocation-failures.patch --]
[-- Type: text/x-diff, Size: 950 bytes --]

From 321c6a26fade377642664c7a2f6a6f2999266ce1 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 23 Sep 2015 18:19:34 +0000
Subject: [PATCH] regcomp: propagate allocation failures

The error code of an allocating function was not checked in tre_add_tag.
---
 src/regex/regcomp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index 978dd87..330de46 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -1584,7 +1584,8 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree,
 		  {
 		    status = tre_add_tag_right(mem, left, tag_left);
 		    tnfa->tag_directions[tag_left] = TRE_TAG_MAXIMIZE;
-		    status = tre_add_tag_right(mem, right, tag_right);
+		    if (status == REG_OK)
+		      status = tre_add_tag_right(mem, right, tag_right);
 		    tnfa->tag_directions[tag_right] = TRE_TAG_MAXIMIZE;
 		  }
 		num_tags += 2;
-- 
2.4.1


  parent reply	other threads:[~2015-09-23 20:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23  5:58 Khem Raj
2015-09-23 19:38 ` Rich Felker
2015-09-23 20:02   ` Jens Gustedt
2015-09-24  0:34     ` Rich Felker
2015-09-24  7:22       ` Jens Gustedt
2015-09-24  8:51         ` [PATCH] help static analysis by avoiding to hold state in a pointer that is subject to arithmetic Jens Gustedt
2015-09-25 15:35         ` Results of static analysis with clang static analyser Matt Avery
2015-09-25 21:37           ` Jens Gustedt
2015-09-23 20:11 ` Szabolcs Nagy [this message]
2015-09-24  6:35   ` Rich Felker
2015-09-23 20:34 ` Szabolcs Nagy

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=20150923201131.GF10551@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).