This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [COMMIT PATCH] remote: Map invalid signal numbers to GDB_SIGNAL_UNKNOWN.


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I realized that remote.c is not validating input here.  Currently, if
Pedro> a remote stub sends in an invalid signal number (or put another way,
Pedro> if a future stub sends a new signal an old GDB doesn't know about),
Pedro> GDB will do out of bounds accesses in the
Pedro> signal_pass/signal_stop/signal_program arrays.  It'll probably be a
Pedro> long while before we add another signal number (and buggy stubs should
Pedro> just be fixed), but can't hurt to be defensive.

Pedro> +	if (GDB_SIGNAL_FIRST <= sig && sig < GDB_SIGNAL_LAST)
Pedro> +	  event->ws.value.sig = (enum gdb_signal) sig;
Pedro> +	else
Pedro> +	  event->ws.value.sig = GDB_SIGNAL_UNKNOWN;

Perhaps if remote_debug, this could print a message about the change.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]