asahi: decode: Do not assert on buffer overruns

This kills the hypervisor, let's just print and return.

Also flush after decoding, so that if something else goes wrong at least
we get the logs up to that point.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
This commit is contained in:
Asahi Lina 2023-08-16 21:36:43 +09:00 committed by Marge Bot
parent acd5ed0451
commit 0424017e72

View file

@ -486,10 +486,13 @@ agxdecode_usc(const uint8_t *map, UNUSED uint64_t *link, UNUSED bool verbose,
#define PPP_PRINT(map, header_name, struct_name, human) \
if (hdr.header_name) { \
assert(((map + AGX_##struct_name##_LENGTH) <= (base + size)) && \
"buffer overrun in PPP update"); \
if (((map + AGX_##struct_name##_LENGTH) > (base + size))) { \
fprintf(agxdecode_dump_stream, "Buffer overrun in PPP update\n"); \
return; \
} \
DUMP_CL(struct_name, map, human); \
map += AGX_##struct_name##_LENGTH; \
fflush(agxdecode_dump_stream); \
}
static void