mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 03:48:06 +02:00
gfxstream: Fix strict aliasing violations in VkDecoder
Test: cvd create --gpu_mode=gfxstream_guest_angle_host_swiftshader Reviewed-by: Aaron Ruby <aruby@qnx.com> Reviewed-by: Marcin Radomski <dextero@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35494>
This commit is contained in:
parent
f3e9f0e9a6
commit
3bf5347436
2 changed files with 7 additions and 2 deletions
|
|
@ -888,8 +888,12 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream,
|
|||
self.cgen.beginBlock() # while loop
|
||||
|
||||
self.cgen.stmt("const uint8_t* packet = (const uint8_t *)ptr")
|
||||
self.cgen.stmt("uint32_t opcode = *(uint32_t *)ptr")
|
||||
self.cgen.stmt("uint32_t packetLen = *(uint32_t *)(ptr + 4)")
|
||||
self.cgen.stmt("uint32_t opcode")
|
||||
self.cgen.stmt("std::memcpy(&opcode, ptr, sizeof(uint32_t))")
|
||||
self.cgen.line("")
|
||||
self.cgen.stmt("uint32_t packetLen")
|
||||
self.cgen.stmt("std::memcpy(&packetLen, ptr + 4, sizeof(uint32_t))")
|
||||
self.cgen.line("")
|
||||
self.cgen.line("""
|
||||
// packetLen should be at least 8 (op code and packet length) and should not be excessively large
|
||||
if (packetLen < 8 || packetLen > MAX_PACKET_LENGTH) {
|
||||
|
|
|
|||
|
|
@ -560,6 +560,7 @@ class BumpPool;
|
|||
#include "VulkanDispatch.h"
|
||||
#include "%s.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue