]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR23940, check bounds before using
authorWu Heng <wu.heng@zte.com.cn>
Fri, 25 Jan 2019 03:11:47 +0000 (13:41 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 25 Jan 2019 04:29:42 +0000 (14:59 +1030)
PR gas/23940
* macro.c (getstring): Check array bound before accessing.

gas/ChangeLog
gas/macro.c

index a930a842424cf2ab934910af6abd7e75006aad1a..50eea849d00930f49adabc7c584aff9dcb4e759e 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-25  Wu Heng  <wu.heng@zte.com.cn>
+
+       PR gas/23940
+       * macro.c (getstring): Check array bound before accessing.
+
 2019-01-25  Alan Modra  <amodra@gmail.com>
 
        PR 20902
index 68ae04b010b5ee87feabed517e6c871a72e8a7ff..5f41c13cb80fcd80de3ce93fa6076bce88224ad9 100644 (file)
@@ -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] == '!')
                {