1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug fix when accessing the String table

This commit is contained in:
Alain Magloire 2003-10-19 01:14:53 +00:00
parent 3736b2c199
commit 347db0a84e
2 changed files with 12 additions and 2 deletions

View file

@ -406,8 +406,10 @@ public class Coff {
public String getName(byte[] table) {
if (table.length > 0 && isLongName()) {
ReadMemoryAccess memory = new ReadMemoryAccess(_n_name, true);
memory.getInt();
int offset = memory.getInt();
memory.getInt(); // pass over the first 4 bytes.
// 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) {
for (int i = offset; i < table.length; i++) {
if (table[i] == 0) {

View file

@ -438,6 +438,14 @@ public class PE {
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 {
if (rfile != null) {
rfile.close();