mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
added range checks for section string
This commit is contained in:
parent
0a8f96e1d2
commit
8daef5ac9c
1 changed files with 6 additions and 4 deletions
|
@ -167,6 +167,8 @@ public class Elf {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
try {
|
try {
|
||||||
if ( section_strtab == null ) {
|
if ( section_strtab == null ) {
|
||||||
|
if ( ehdr.e_shstrndx > sections.length || ehdr.e_shstrndx < 0)
|
||||||
|
return EMPTY_STRING;
|
||||||
int size = (int)sections[ehdr.e_shstrndx].sh_size;
|
int size = (int)sections[ehdr.e_shstrndx].sh_size;
|
||||||
if ( size <= 0 || size > efile.length() )
|
if ( size <= 0 || size > efile.length() )
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
|
@ -555,18 +557,18 @@ public class Elf {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void commonSetup( String file, long offset, boolean filton )
|
private void commonSetup( String file, long offset, boolean filton )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
this.cppFiltEnabled = filton;
|
this.cppFiltEnabled = filton;
|
||||||
|
|
||||||
efile = new ERandomAccessFile(file, "r");
|
|
||||||
efile.setFileOffset( offset );
|
|
||||||
try {
|
try {
|
||||||
|
efile = new ERandomAccessFile(file, "r");
|
||||||
|
efile.setFileOffset( offset );
|
||||||
ehdr = new ELFhdr();
|
ehdr = new ELFhdr();
|
||||||
this.file = file;
|
this.file = file;
|
||||||
} finally {
|
} finally {
|
||||||
if ( ehdr == null ) {
|
if ( ehdr == null ) {
|
||||||
efile.close();
|
dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue