Merge pull request #116 from bkokoszx/logger-rejecting-trace-address

logger: refinement handling invalid trace address
This commit is contained in:
Liam Girdwood 2018-10-26 11:35:57 +01:00 committed by GitHub
commit b5eb15516c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -282,10 +282,17 @@ static int logger_read(struct convert_config *config,
return -ferror(config->in_fd);
}
/* checking log address */
/* checking if received trace address is located in
* entry section in elf file.
*/
if ((dma_log.address < snd->base_address) ||
dma_log.address > snd->base_address + snd->data_length)
dma_log.address > snd->base_address + snd->data_length) {
/* in case the address is not correct input fd should be
* move forward by one DWORD, not entire struct dma_log
*/
fseek(config->in_fd, -(sizeof(dma_log) - sizeof(uint32_t)), SEEK_CUR);
continue;
}
/* fetching entry from elf dump */
ret = fetch_entry(config, snd->base_address, snd->data_offset,