Skip to content

Commit

Permalink
awful workaround for mhy0 search false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
khang06 committed Jul 31, 2021
1 parent a7d939a commit ed66ac2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions blkstuff/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ void mhy0_extract(const char* out_format, int block_index, uint8_t* input, size_
uint32_t size = *(uint32_t*)(input + 4);
//printf("first size 0x%x\n", size);

if (size > input_size) {
// TODO: this is probably caused by the awful mhy0 searching approach i do instead of properly calculating offsets
printf("oh shit! attempted to get 0x%x bytes out of a 0x%llx input! skipping mhy0 %d...", size, input_size, block_index);
return;
}

auto* data = new uint8_t[size];
memcpy(data, input + 8, size);

Expand Down

0 comments on commit ed66ac2

Please sign in to comment.