summaryrefslogtreecommitdiffstats
path: root/src/intel/tools
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2016-10-25 12:49:52 +0100
committerLionel Landwerlin <[email protected]>2016-10-31 22:03:09 +0000
commit46d67799a68645609e01ab7c8b48e552ad6e2331 (patch)
tree8278f0e5e2135565754e1b0074f890943de2d8b9 /src/intel/tools
parent6f05b69572071cf9eca3694ff32e889abee7b073 (diff)
intel: aubinator: fix assumptions on amount of required data
We require 12 bytes of headers but in some cases we just need 4. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/intel/tools')
-rw-r--r--src/intel/tools/aubinator.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 11709c87a71..67f1f0db153 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -946,7 +946,7 @@ aub_file_decode_batch(struct aub_file *file, struct gen_spec *spec)
uint32_t *p, h, device, data_type, *new_cursor;
int header_length, payload_size, bias;
- if (file->end - file->cursor < 12)
+ if (file->end - file->cursor < 1)
return AUB_ITEM_DECODE_NEED_MORE_DATA;
p = file->cursor;
@@ -970,9 +970,13 @@ aub_file_decode_batch(struct aub_file *file, struct gen_spec *spec)
payload_size = 0;
switch (h & 0xffff0000) {
case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_HEADER):
+ if (file->end - file->cursor < 12)
+ return AUB_ITEM_DECODE_NEED_MORE_DATA;
payload_size = p[12];
break;
case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_BLOCK):
+ if (file->end - file->cursor < 4)
+ return AUB_ITEM_DECODE_NEED_MORE_DATA;
payload_size = p[4];
break;
default: