Re: [PATCH 11/12] hw/core/loader: read_targphys(): add upper bound

2023-09-26 Thread Peter Maydell
On Mon, 25 Sept 2023 at 20:41, Vladimir Sementsov-Ogievskiy wrote: > > Coverity doesn't like using "untrusted" values, coming from buffers and > fd-s as length to do IO and allocations. And that's make sense. The > function is used three times with "untrusted" nbytes parameter. Let's > introduce a

Re: [PATCH 11/12] hw/core/loader: read_targphys(): add upper bound

2023-09-26 Thread Vladimir Sementsov-Ogievskiy
On 25.09.23 23:12, Michael Tokarev wrote: 25.09.2023 22:40, Vladimir Sementsov-Ogievskiy wrote: Coverity doesn't like using "untrusted" values, coming from buffers and fd-s as length to do IO and allocations. And that's make sense. The "And that makes sense".  Just a nitpick in commit comment.

Re: [PATCH 11/12] hw/core/loader: read_targphys(): add upper bound

2023-09-25 Thread Michael Tokarev
25.09.2023 22:40, Vladimir Sementsov-Ogievskiy wrote: Coverity doesn't like using "untrusted" values, coming from buffers and fd-s as length to do IO and allocations. And that's make sense. The "And that makes sense". Just a nitpick in commit comment. function is used three times with "untru

[PATCH 11/12] hw/core/loader: read_targphys(): add upper bound

2023-09-25 Thread Vladimir Sementsov-Ogievskiy
Coverity doesn't like using "untrusted" values, coming from buffers and fd-s as length to do IO and allocations. And that's make sense. The function is used three times with "untrusted" nbytes parameter. Let's introduce at least empirical limit of 1G for it. While being here make the function stat