Merge branch 'GP-5371_ryanmkurtz_PR-7436_nmggithub_macho-ints'

This commit is contained in:
Ryan Kurtz 2025-02-12 06:23:17 -05:00
commit eaa8aeb0c8
5 changed files with 22 additions and 22 deletions

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -304,7 +304,7 @@ public class DynamicSymbolTableCommand extends LoadCommand {
} }
@Override @Override
public int getLinkerDataOffset() { public long getLinkerDataOffset() {
return indirectsymoff; return indirectsymoff;
} }

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -58,7 +58,7 @@ public class LinkEditDataCommand extends LoadCommand {
} }
@Override @Override
public int getLinkerDataOffset() { public long getLinkerDataOffset() {
return dataoff; return dataoff;
} }

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -91,7 +91,7 @@ public abstract class LoadCommand implements StructConverter {
* *
* @return The file offset of this load command's "linker data", or 0 if it has no linker data * @return The file offset of this load command's "linker data", or 0 if it has no linker data
*/ */
public int getLinkerDataOffset() { public long getLinkerDataOffset() {
return 0; return 0;
} }
@ -170,7 +170,7 @@ public abstract class LoadCommand implements StructConverter {
* @param size The size (actual size not important, but 0 will cause null to be returned) * @param size The size (actual size not important, but 0 will cause null to be returned)
* @return The converted {@link Address}, or null if there is no corresponding {@link Address} * @return The converted {@link Address}, or null if there is no corresponding {@link Address}
*/ */
protected Address fileOffsetToAddress(Program program, MachHeader header, int fileOffset, protected Address fileOffsetToAddress(Program program, MachHeader header, long fileOffset,
int size) { int size) {
if (fileOffset != 0 && size != 0) { if (fileOffset != 0 && size != 0) {
AddressSpace space = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace space = program.getAddressFactory().getDefaultAddressSpace();

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -37,9 +37,9 @@ import ghidra.util.task.TaskMonitor;
* Represents a symtab_command structure * Represents a symtab_command structure
*/ */
public class SymbolTableCommand extends LoadCommand { public class SymbolTableCommand extends LoadCommand {
private int symoff; private long symoff;
private int nsyms; private int nsyms;
private int stroff; private long stroff;
private int strsize; private int strsize;
private List<NList> symbols = new ArrayList<NList>(); private List<NList> symbols = new ArrayList<NList>();
@ -58,9 +58,9 @@ public class SymbolTableCommand extends LoadCommand {
MachHeader header) throws IOException { MachHeader header) throws IOException {
super(loadCommandReader); super(loadCommandReader);
symoff = loadCommandReader.readNextInt(); symoff = loadCommandReader.readNextUnsignedInt();
nsyms = loadCommandReader.readNextInt(); nsyms = loadCommandReader.readNextInt();
stroff = loadCommandReader.readNextInt(); stroff = loadCommandReader.readNextUnsignedInt();
strsize = loadCommandReader.readNextInt(); strsize = loadCommandReader.readNextInt();
List<NList> nlistList = new ArrayList<>(nsyms); List<NList> nlistList = new ArrayList<>(nsyms);
@ -90,7 +90,7 @@ public class SymbolTableCommand extends LoadCommand {
* The symbol table is an array of nlist data structures. * The symbol table is an array of nlist data structures.
* @return symbol table offset * @return symbol table offset
*/ */
public int getSymbolOffset() { public long getSymbolOffset() {
return symoff; return symoff;
} }
@ -107,7 +107,7 @@ public class SymbolTableCommand extends LoadCommand {
* location of the string table. * location of the string table.
* @return string table offset * @return string table offset
*/ */
public int getStringTableOffset() { public long getStringTableOffset() {
return stroff; return stroff;
} }
@ -169,7 +169,7 @@ public class SymbolTableCommand extends LoadCommand {
} }
@Override @Override
public int getLinkerDataOffset() { public long getLinkerDataOffset() {
return symoff; return symoff;
} }

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -98,7 +98,7 @@ public class ExtractedMacho {
if (cmd instanceof SymbolTableCommand symbolTable) { if (cmd instanceof SymbolTableCommand symbolTable) {
symbolTable.addSymbols(getExtraSymbols()); symbolTable.addSymbols(getExtraSymbols());
} }
int offset = cmd.getLinkerDataOffset(); long offset = cmd.getLinkerDataOffset();
int size = cmd.getLinkerDataSize(); int size = cmd.getLinkerDataSize();
if (offset == 0 || size == 0) { if (offset == 0 || size == 0) {
continue; continue;