mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-5199: per review
GP-5199: forgot a bit GP-5199: fix for 0 length
This commit is contained in:
parent
420dd7ce0c
commit
c2224aa538
1 changed files with 13 additions and 3 deletions
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -83,8 +83,18 @@ public class DebugMisc implements StructConverter {
|
|||
actualData =
|
||||
(unicode ? reader.readNextUnicodeString(length) : reader.readNextAsciiString());
|
||||
}
|
||||
else if (length == 0 && !unicode) {
|
||||
actualData = reader.readNextAsciiString();
|
||||
// NB: should be a multiple of 4 per winnt.h
|
||||
// 13 = len(start of struct) + null
|
||||
length = (int) Math.ceil((actualData.length() + 13)/4.0)*4;
|
||||
if (length > DebugDirectory.IMAGE_SIZEOF_DEBUG_DIRECTORY) {
|
||||
length = DebugDirectory.IMAGE_SIZEOF_DEBUG_DIRECTORY;
|
||||
}
|
||||
Msg.warn(this, "Zero length structure - defaulting to " + Integer.toHexString(length));
|
||||
}
|
||||
else {
|
||||
Msg.error(this, "Bad string length " + Integer.toHexString(length));
|
||||
Msg.error(this, "Bad structure length " + Integer.toHexString(length));
|
||||
}
|
||||
|
||||
reader.setPointerIndex(oldIndex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue