asan: unwind-ia64.c: stack buffer overflow

Message ID 20210207042737.GO5348@bubble.grove.modra.org
State New
Headers show
Series
  • asan: unwind-ia64.c: stack buffer overflow
Related show

Commit Message

H.J. Lu via Binutils Feb. 7, 2021, 4:27 a.m.
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.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/binutils/unwind-ia64.c b/binutils/unwind-ia64.c
index 6eef917a6a9..fb22f3fd54f 100644
--- a/binutils/unwind-ia64.c
+++ b/binutils/unwind-ia64.c
@@ -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;
     }
 }