X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Farm%2Farmos.c;h=76c449b73d0f7dd4b69fe32de97056fb354c0efd;hb=87f83f20023bf366c14ec4e0fd307948d96caaee;hp=c49036f1224246e257e339818efd0539b6b7e9d3;hpb=91d6df784db745df2b0a6827de8306246083bc94;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/arm/armos.c b/sim/arm/armos.c index c49036f122..76c449b73d 100644 --- a/sim/arm/armos.c +++ b/sim/arm/armos.c @@ -23,6 +23,7 @@ #include "config.h" #include "ansidecl.h" +#include "libiberty.h" #include #include @@ -260,7 +261,10 @@ SWIopen (ARMul_State * state, ARMword name, ARMword SWIflags) return; /* Now we need to decode the Demon open mode. */ - flags = translate_open_mode[SWIflags]; + if (SWIflags >= ARRAY_SIZE (translate_open_mode)) + flags = 0; + else + flags = translate_open_mode[SWIflags]; /* Filename ":tt" is special: it denotes stdin/out. */ if (strcmp (buf, ":tt") == 0)