mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-06 07:45:50 +02:00
Bug fix when accessing the String table
This commit is contained in:
parent
3736b2c199
commit
347db0a84e
2 changed files with 12 additions and 2 deletions
|
@ -406,8 +406,10 @@ public class Coff {
|
||||||
public String getName(byte[] table) {
|
public String getName(byte[] table) {
|
||||||
if (table.length > 0 && isLongName()) {
|
if (table.length > 0 && isLongName()) {
|
||||||
ReadMemoryAccess memory = new ReadMemoryAccess(_n_name, true);
|
ReadMemoryAccess memory = new ReadMemoryAccess(_n_name, true);
|
||||||
memory.getInt();
|
memory.getInt(); // pass over the first 4 bytes.
|
||||||
int offset = memory.getInt();
|
// The first for bytes of the string table represent the
|
||||||
|
// number of bytes in the string table.
|
||||||
|
int offset = memory.getInt() - 4;
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
for (int i = offset; i < table.length; i++) {
|
for (int i = offset; i < table.length; i++) {
|
||||||
if (table[i] == 0) {
|
if (table[i] == 0) {
|
||||||
|
|
|
@ -438,6 +438,14 @@ public class PE {
|
||||||
return attrib;
|
return attrib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Attribute getAttributes(String file) throws IOException {
|
||||||
|
PE pe = new PE(file);
|
||||||
|
Attribute attrib = pe.getAttribute();
|
||||||
|
pe.dispose();
|
||||||
|
return attrib;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void dispose() throws IOException {
|
public void dispose() throws IOException {
|
||||||
if (rfile != null) {
|
if (rfile != null) {
|
||||||
rfile.close();
|
rfile.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue