linux-user: fix signal number range check

When translating between host and target signal numbers keep negative
numbers unchanged, avoiding access beyond array bounds.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 878v2b8sek.fsf@igel.home
This commit is contained in:
Andreas Schwab 2013-07-02 14:04:12 +01:00 committed by Riku Voipio
parent 7ff7b66618
commit 167c50d8f9

View File

@ -102,14 +102,14 @@ static inline int sas_ss_flags(unsigned long sp)
int host_to_target_signal(int sig)
{
if (sig >= _NSIG)
if (sig < 0 || sig >= _NSIG)
return sig;
return host_to_target_signal_table[sig];
}
int target_to_host_signal(int sig)
{
if (sig >= _NSIG)
if (sig < 0 || sig >= _NSIG)
return sig;
return target_to_host_signal_table[sig];
}