Re: [hatari-devel] windows build failing on cirrus-ci |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] windows build failing on cirrus-ci
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sat, 27 Apr 2024 04:13:11 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1714191193; bh=HwdwF0oGuQIM8soXD8hcZrfaJwaXZs3JSOQ9b/JRp1s=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=KLjHDyq1fXRZohPCx+bSgA8yhr4UNCIomQBZP2KMT6ahMKzVrsyBCkyfgia+M2I6c sVM9JSQposKA5BI3PH06SfwJxMSCiW1Rk6YQrbOn8PoIj6WfcCQPj7uEKZsMWPNIgQ ZWi9cLYQRjvCcpvJiWvLyA135cMnr5RdCroaGA4VIL/K9ttTptNk9a4YnSK5l/VeSs q1PmWD7/h09IKBs/7FCA4KpnYEdVawmEFRg79Z5drj0cj+3/lpMqV5N5wXHZN0i+VF hmtHCPpNrY2i5jM7P9HqVpBP83mn5hP92iK4XJvHFz+kVZCmqznNlLbGOjEVVsiNlM s9Tg6sr9Xhq+g==
Am Thu, 25 Apr 2024 03:09:15 +0300
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
> Hi,
>
> On 24.4.2024 20.03, Christian Zietz wrote:
> > Nicolas Pomarède schrieb:
> >
> >> Yes, the problem is in the new function "loadSymFile"
> >>
> >> I don't know if this is supported in a more recent version of visual C
> >> than the one used in cirrus-ci,
> >
> > I am always very cautions about variable length arrays, anyway. Like any
> > local variable, they are allocated on the stack; but with a VLA one can
> > only cross one's fingers to hope that it fits without causing a stack
> > exhaustion.
>
> AFAIK all the modern OSes have virtual memory and automatically grow the
> stack as needed (in main thread, and Hatari code is not threaded).
>
> I.e. if (main thread) stack runs out, either process has ran out of
> (64-bit) address space, or machine it's running, is out of RAM+swap and
> anything at all will fail.
I think it's a little bit more than that: If you are using variable length
arrays on the stack in a program where you process untrusted data (imagine
someone would write a malicious PRG and tricks you into using it), the
variable length arrays could provide a way to the malicious code to control
the stack layout, which could be used for exploits. It's unlikely for the
Hatari case, but still, maybe it's a better habbit indeed to simply avoid
variable length arrays on the stack in general.
(For some funny reasons, Microsoft still allows alloca() and we used it in
the past in Hatari already to workaround the problems with variable-length
arrays, see e.g. commit 76c855b5b237c5 ... but maybe we should forbid
alloca() in the Hatari code nowadays, too...)
Thomas