Bug 463274 - File type is not checked in one case in tcf_elf.c search_regions()
Summary: File type is not checked in one case in tcf_elf.c search_regions()
Status: NEW
Alias: None
Product: TCF
Classification: Tools
Component: Agent (show other bugs)
Version: 1.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-27 06:04 EDT by Manuel Coutand CLA
Modified: 2015-05-22 12:59 EDT (History)
1 user (show)

See Also:


Attachments
proposed patch (8.77 KB, patch)
2015-03-27 06:05 EDT, Manuel Coutand CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Coutand CLA 2015-03-27 06:04:50 EDT
The file type is not checked as being an ELF file in the last "fallback" else if of search_regions() in tcf_elf.c

else if (r->addr <= addr1 && r->addr + r->size > addr0) {
    add_region(res, r);
}

This caused the ELF reader to be assumed valid even when the symbol file
is not ELF, if the ELF reader was registered first because it contained a region that was added when it should not have.
Comment 1 Manuel Coutand CLA 2015-03-27 06:05:51 EDT
Created attachment 251949 [details]
proposed patch

Here is a proposed patch that checks for the file type at the begining of the function.
Comment 2 Martin Oberhuber CLA 2015-05-22 12:59:39 EDT
Eugene, what do you think about this patch ?