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 );
|
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 ) {
|
for ( int i = nodeSize ; i < reader.length() ; i += nodeSize ) {
|
||||||
reader.setPointerIndex( i );
|
reader.setPointerIndex( i );
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -15,15 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.file.formats.ios.btree;
|
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.BinaryReader;
|
||||||
import ghidra.app.util.bin.StructConverterUtil;
|
import ghidra.app.util.bin.StructConverterUtil;
|
||||||
import ghidra.program.model.data.DataType;
|
import ghidra.program.model.data.DataType;
|
||||||
import ghidra.util.exception.DuplicateNameException;
|
import ghidra.util.exception.DuplicateNameException;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BTreeRootNodeDescriptor extends BTreeNodeDescriptor {
|
public class BTreeRootNodeDescriptor extends BTreeNodeDescriptor {
|
||||||
|
|
||||||
private BTreeHeaderRecord headerRecord;
|
private BTreeHeaderRecord headerRecord;
|
||||||
@@ -40,7 +40,10 @@ public class BTreeRootNodeDescriptor extends BTreeNodeDescriptor {
|
|||||||
|
|
||||||
nodes.add( this );
|
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 ) {
|
for ( int i = nodeSize ; i < reader.length() ; i += nodeSize ) {
|
||||||
reader.setPointerIndex( i );
|
reader.setPointerIndex( i );
|
||||||
|
|||||||
Reference in New Issue
Block a user