Re: Alignment trap in stackgap under arm eabi.

Felix von Leitner <[email protected]> Tue, 26 Jan 2016 16:08:16 +0100
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Thus spake Enrico Scholz ([email protected]):
> >   if (!rand) {
> >     char myrand[10];
> >     ...
> >     rand=myrand;
> >   }
> >   ...
> >   s=*(unsigned short*)(rand+8);
> has an undefined behavior in the '!rand' case ('rand' points to
> out-of-scope memory when reading it).

Technically yes.

Practically gcc only deallocates that memory if the function is left,
and I don't want to allocate the memory if I don't have to.

Also, the whole objective here is to gain access to random bytes in
memory.

Third, this case only happens for antique kernels.

Sigh. I'll change it to alloca.

Felix