asan: unwind-ia64.c: stack buffer overflow
authorAlan Modra <amodra@gmail.com>
Sun, 7 Feb 2021 02:53:34 +0000 (13:23 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 7 Feb 2021 04:19:19 +0000 (14:49 +1030)
Printing "invalid" is better than printing an uninitialised buffer
and occasionally running off the end of the buffer.

* unwind-ia64.c (unw_print_xyreg): Don't leave output buffer
uninitialised on invalid input.

binutils/ChangeLog
binutils/unwind-ia64.c

index 23a8d8eafaf39d9885bd097afce59bde0f0c19f7..69150272843c63aa951c1ee3f3edd04c411be28c 100644 (file)
@@ -1,3 +1,8 @@
+2021-02-07  Alan Modra  <amodra@gmail.com>
+
+       * unwind-ia64.c (unw_print_xyreg): Don't leave output buffer
+       uninitialised on invalid input.
+
 2021-02-06  Alan Modra  <amodra@gmail.com>
 
        PR 27349
index 6eef917a6a9d7920ce539df9a84d4cf2a78efbdb..fb22f3fd54f13ba7ba269160ab588af2015abfb2 100644 (file)
@@ -156,6 +156,10 @@ unw_print_xyreg (char *cp, unsigned int x, unsigned int ytreg)
     case 2: /* br */
       sprintf (cp, "b%u", (ytreg & 0x1f));
       break;
+
+    default:
+      strcpy (cp, "invalid");
+      break;
     }
 }