From: Mans Rullgard <mans@mansr.com>
To: sox-devel@lists.sourceforge.net
Subject: [PATCH v2] hcom: fix crash on input with corrupt dictionary (CVE-2017-11358)
Date: Sun, 29 Apr 2018 16:55:39 +0100 [thread overview]
Message-ID: <20180429155539.26684-1-mans@mansr.com> (raw)
The previous patch was incorrect.
---
src/hcom.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/hcom.c b/src/hcom.c
index e76820e9333f..be17d9d2e58e 100644
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -73,6 +73,14 @@ typedef struct {
size_t pos; /* Where next byte goes */
} priv_t;
+static int dictvalid(int n, int size, int left, int right)
+{
+ if (n > 0 && left < 0)
+ return 1;
+
+ return (unsigned)left < size && (unsigned)right < size;
+}
+
static int startread(sox_format_t * ft)
{
priv_t *p = (priv_t *) ft->priv;
@@ -150,6 +158,11 @@ static int startread(sox_format_t * ft)
lsx_debug("%d %d",
p->dictionary[i].dict_leftson,
p->dictionary[i].dict_rightson);
+ if (!dictvalid(i, dictsize, p->dictionary[i].dict_leftson,
+ p->dictionary[i].dict_rightson)) {
+ lsx_fail_errno(ft, SOX_EHDR, "Invalid dictionary");
+ return SOX_EOF;
+ }
}
rc = lsx_skipbytes(ft, (size_t) 1); /* skip pad byte */
if (rc)
--
2.17.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel
reply other threads:[~2018-04-29 16:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.sourceforge.net/lists/listinfo/sox-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180429155539.26684-1-mans@mansr.com \
--to=sox-devel@lists.sourceforge.net \
/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://80x24.org/mirrors/sox.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).