mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-04-25 17:25:17 +02:00
GP-6713 check length calc
This commit is contained in:
@@ -25,7 +25,10 @@ public class BTreeRootNodeDescriptor extends BTreeNodeDescriptor {
|
||||
|
||||
nodes.add( this );
|
||||
|
||||
int nodeSize = headerRecord.getNodeSize() & 0xffff;
|
||||
int nodeSize = Short.toUnsignedInt(headerRecord.getNodeSize());
|
||||
if (nodeSize == 0) {
|
||||
throw new IOException("Bad nodeSize: " + nodeSize);
|
||||
}
|
||||
|
||||
for ( int i = nodeSize ; i < reader.length() ; i += nodeSize ) {
|
||||
reader.setPointerIndex( i );
|
||||
|
||||
@@ -15,15 +15,15 @@
|
||||
*/
|
||||
package ghidra.file.formats.ios.btree;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverterUtil;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BTreeRootNodeDescriptor extends BTreeNodeDescriptor {
|
||||
|
||||
private BTreeHeaderRecord headerRecord;
|
||||
@@ -40,7 +40,10 @@ public class BTreeRootNodeDescriptor extends BTreeNodeDescriptor {
|
||||
|
||||
nodes.add( this );
|
||||
|
||||
int nodeSize = headerRecord.getNodeSize() & 0xffff;
|
||||
int nodeSize = Short.toUnsignedInt(headerRecord.getNodeSize());
|
||||
if (nodeSize == 0) {
|
||||
throw new IOException("Bad nodeSize: " + nodeSize);
|
||||
}
|
||||
|
||||
for ( int i = nodeSize ; i < reader.length() ; i += nodeSize ) {
|
||||
reader.setPointerIndex( i );
|
||||
|
||||
Reference in New Issue
Block a user