From: Wu Heng Date: Fri, 25 Jan 2019 03:11:47 +0000 (+1030) Subject: PR23940, check bounds before using X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c856219bcaedba3e00f9875e01957fe64a3c3d58;p=thirdparty%2Fbinutils-gdb.git PR23940, check bounds before using PR gas/23940 * macro.c (getstring): Check array bound before accessing. (cherry picked from commit 10c172ba93dde7cb7c46982ca217e646565bf938) --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 321e243a878..46b58d2a302 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2019-08-02 Alan Modra + + Backport from master + 2019-01-25 Wu Heng + PR gas/23940 + * macro.c (getstring): Check array bound before accessing. + 2019-07-24 Kyrylo Tkachov Backport from mainline diff --git a/gas/macro.c b/gas/macro.c index 68ae04b010b..5f41c13cb80 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -285,8 +285,8 @@ getstring (size_t idx, sb *in, sb *acc) { int nest = 0; idx++; - while ((in->ptr[idx] != '>' || nest) - && idx < in->len) + while (idx < in->len + && (in->ptr[idx] != '>' || nest)) { if (in->ptr[idx] == '!') {