Java Code Examples for ghidra.app.util.bin.BinaryReader#isValidIndex()
The following examples show how to use
ghidra.app.util.bin.BinaryReader#isValidIndex() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObjectiveC2_Class.java From ghidra with Apache License 2.0 | 6 votes |
private void readSuperClass(BinaryReader reader) throws IOException { long index = 0; try { index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); } catch (IOException ioe) { //Trying to read uninitialized memory return; } if (_state.classIndexMap.containsKey(index)) { superclass = _state.classIndexMap.get(index); return; } if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); superclass = new ObjectiveC2_Class(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 2
Source File: ObjectiveC2_Class.java From ghidra with Apache License 2.0 | 6 votes |
private void readISA(BinaryReader reader) throws IOException { long index = 0; try { index = ObjectiveC2_Utilities.readNextIndex(reader, _state.is32bit); } catch (IOException ioe) { //Trying to read uninitialized memory return; } if (_state.classIndexMap.containsKey(index)) { isa = _state.classIndexMap.get(index); return; } if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); isa = new ObjectiveC2_Class(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 3
Source File: ObjectiveC2_Class.java From ghidra with Apache License 2.0 | 6 votes |
private void readData(BinaryReader reader) throws IOException { long index = 0; try { index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); } catch (IOException ioe) { //Trying to read uninitialized memory return; } if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); data = new ObjectiveC2_ClassRW(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 4
Source File: ObjectiveC2_InstanceVariable.java From ghidra with Apache License 2.0 | 6 votes |
public ObjectiveC2_InstanceVariable(ObjectiveC2_State state, BinaryReader reader) throws IOException { this._state = state; if (state.is32bit) { offset = reader.readNextInt() & Conv.INT_MASK; } else { offset = reader.readNextLong(); } long nameIndex = ObjectiveC1_Utilities.readNextIndex(reader, state.is32bit); if (nameIndex > 0 && reader.isValidIndex(nameIndex)) { name = reader.readAsciiString( nameIndex ); } long typeIndex = ObjectiveC1_Utilities.readNextIndex(reader, state.is32bit); if (typeIndex > 0 && reader.isValidIndex(typeIndex)) { type = reader.readAsciiString( typeIndex ); } alignment = reader.readNextInt(); size = reader.readNextInt(); }
Example 5
Source File: ObjectiveC2_Category.java From ghidra with Apache License 2.0 | 5 votes |
private void readInstanceProperties(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); instanceProperties = new ObjectiveC2_PropertyList(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 6
Source File: ObjectiveC2_Category.java From ghidra with Apache License 2.0 | 5 votes |
private void readProtocols(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); protocols = new ObjectiveC2_ProtocolList(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 7
Source File: ObjectiveC2_Category.java From ghidra with Apache License 2.0 | 5 votes |
private void readClassMethods(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); classMethods = new ObjectiveC2_MethodList(_state, reader, ObjectiveC_MethodType.CLASS); reader.setPointerIndex(originalIndex); } }
Example 8
Source File: ObjectiveC2_Category.java From ghidra with Apache License 2.0 | 5 votes |
private void readInstanceMethods(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); instanceMethods = new ObjectiveC2_MethodList(_state, reader, ObjectiveC_MethodType.INSTANCE); reader.setPointerIndex(originalIndex); } }
Example 9
Source File: ObjectiveC2_Category.java From ghidra with Apache License 2.0 | 5 votes |
private void readClass(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (_state.classIndexMap.containsKey(index)) { cls = _state.classIndexMap.get(index); return; } if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); cls = new ObjectiveC2_Class(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 10
Source File: ObjectiveC2_Protocol.java From ghidra with Apache License 2.0 | 5 votes |
private void readInstanceProperties(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); instanceProperties = new ObjectiveC2_PropertyList(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 11
Source File: ObjectiveC2_Protocol.java From ghidra with Apache License 2.0 | 5 votes |
private void readOptionalClassMethods(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); optionalClassMethods = new ObjectiveC2_MethodList(_state, reader, ObjectiveC_MethodType.CLASS); reader.setPointerIndex(originalIndex); } }
Example 12
Source File: ObjectiveC2_Protocol.java From ghidra with Apache License 2.0 | 5 votes |
private void readOptionalInstanceMethods(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); optionalInstanceMethods = new ObjectiveC2_MethodList(_state, reader, ObjectiveC_MethodType.INSTANCE); reader.setPointerIndex(originalIndex); } }
Example 13
Source File: ObjectiveC2_Protocol.java From ghidra with Apache License 2.0 | 5 votes |
private void readClassMethods(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); classMethods = new ObjectiveC2_MethodList(_state, reader, ObjectiveC_MethodType.CLASS); reader.setPointerIndex(originalIndex); } }
Example 14
Source File: ObjectiveC2_Protocol.java From ghidra with Apache License 2.0 | 5 votes |
private void readInstanceMethods(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); instanceMethods = new ObjectiveC2_MethodList(_state, reader, ObjectiveC_MethodType.INSTANCE); reader.setPointerIndex(originalIndex); } }
Example 15
Source File: ObjectiveC2_Protocol.java From ghidra with Apache License 2.0 | 5 votes |
private void readProtocols(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { long originalIndex = reader.getPointerIndex(); reader.setPointerIndex(index); protocols = new ObjectiveC2_ProtocolList(_state, reader); reader.setPointerIndex(originalIndex); } }
Example 16
Source File: ObjectiveC2_Category.java From ghidra with Apache License 2.0 | 4 votes |
private void readName(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { name = reader.readAsciiString(index); } }
Example 17
Source File: ObjectiveC2_Protocol.java From ghidra with Apache License 2.0 | 4 votes |
private void readName(BinaryReader reader) throws IOException { long index = ObjectiveC1_Utilities.readNextIndex(reader, _state.is32bit); if (index != 0 && reader.isValidIndex(index)) { name = reader.readAsciiString(index); } }