From e6ba3e49af097c94ae74c0408af99f2a98687c42 Mon Sep 17 00:00:00 2001 From: James Fulop Date: Tue, 26 Nov 2019 16:20:49 -0800 Subject: [PATCH] add an assert to catch unknown opcodes earlier --- src/shader_dxbc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shader_dxbc.cpp b/src/shader_dxbc.cpp index 9dca204f1..6fa1cf350 100644 --- a/src/shader_dxbc.cpp +++ b/src/shader_dxbc.cpp @@ -1065,6 +1065,8 @@ namespace bgfx // +-------------------------------- extended _instruction.opcode = DxbcOpcode::Enum( (token & UINT32_C(0x000007ff) ) ); + BX_CHECK(_instruction.opcode < DxbcOpcode::Enum::Count, "unknown opcode"); + _instruction.length = uint8_t( (token & UINT32_C(0x7f000000) ) >> 24); bool extended = 0 != (token & UINT32_C(0x80000000) );