From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: karthik.188@gmail.com
Cc: Junio C Hamano <gitster@pobox.com>,
GIT Mailing-list <git@vger.kernel.org>
Subject: [PATCH] ref-filter.c: don't stomp on memory
Date: Sun, 7 Feb 2016 00:23:15 +0000 [thread overview]
Message-ID: <56B68E73.2050303@ramsayjones.plus.com> (raw)
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Karthik,
If you need to re-roll your 'kn/ref-filter-atom-parsing' branch, could
you please squash this (or something like it) into the relevant patch
(commit 6613d5f1, "ref-filter: introduce parsing functions for each valid
atom", 31-01-2016).
This evening, (by mistake!) I built the pu branch with -fsanitize=address
in my CFLAGS. This resulted in many test failures, which were all caused
by the memcmp() call below stomping all over memory.
Hmm, as I was writing this email, I had a vague recollection of another
email on the list recently mentioning this code. So, if this has already
been reported, sorry for the noise!
ATB,
Ramsay Jones
ref-filter.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ref-filter.c b/ref-filter.c
index d48e2a3..c98065e 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -260,7 +260,8 @@ int parse_ref_filter_atom(const char *atom, const char *ep)
* table.
*/
arg = memchr(sp, ':', ep - sp);
- if ((!arg || len == arg - sp) &&
+ if ((( arg && len == arg - sp) ||
+ (!arg && len == ep - sp )) &&
!memcmp(valid_atom[i].name, sp, len))
break;
}
--
2.7.0
next reply other threads:[~2016-02-07 0:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-07 0:23 Ramsay Jones [this message]
2016-02-07 3:16 ` [PATCH] ref-filter.c: don't stomp on memory Eric Sunshine
2016-02-07 4:50 ` Karthik Nayak
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=56B68E73.2050303@ramsayjones.plus.com \
--to=ramsay@ramsayjones.plus.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karthik.188@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox