Ghidra is a software reverse engineering (SRE) framework
GP-7235 PackedDecode::skipAttribute
caheckmand105789b331d
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.ccindex 73fb5701a3..c2828512ea 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.cc@@ -648,7 +648,7 @@ void PackedDecode::skipAttribute(void)uint1 attribType = typeByte >> TYPECODE_SHIFT;if (attribType == TYPECODE_BOOLEAN || attribType == TYPECODE_SPECIALSPACE)return; // has no additional data- uint4 length = readLengthCode(typeByte); // Length of data in bytes+ uint8 length = readLengthCode(typeByte); // Length of data in bytesif (attribType == TYPECODE_STRING) {length = readInteger(length); // Read length field to get final length of string}@@ -664,7 +664,7 @@ void PackedDecode::skipAttributeRemaining(uint1 typeByte)uint1 attribType = typeByte >> TYPECODE_SHIFT;if (attribType == TYPECODE_BOOLEAN || attribType == TYPECODE_SPECIALSPACE)return; // has no additional data- uint4 length = readLengthCode(typeByte); // Length of data in bytes+ uint8 length = readLengthCode(typeByte); // Length of data in bytesif (attribType == TYPECODE_STRING) {length = readInteger(length); // Read length field to get final length of string}diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.hhindex 9817f7b013..3c1aec132b 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.hh+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/marshal.hh@@ -536,7 +536,7 @@ private:uint1 getByte(Position &pos) { return *pos.current; } ///< Get the byte at the current position, do not advanceuint1 getBytePlus1(Position &pos); ///< Get the byte following the current byte, do not advance positionuint1 getNextByte(Position &pos); ///< Get the byte at the current position and advance to the next byte- void advancePosition(Position &pos,uint4 skip); ///< Advance the position by the given number of bytes+ void advancePosition(Position &pos,uint8 skip); ///< Advance the position by the given number of bytesuint8 readInteger(int4 len); ///< Read an integer from the \e current position given its length in bytesuint4 readLengthCode(uint1 typeByte) { return ((uint4)typeByte & PackedFormat::LENGTHCODE_MASK); } ///< Extract length code from type bytevoid findMatchingAttribute(const AttributeId &attribId); ///< Find attribute matching the given id in open element@@ -631,7 +631,7 @@ inline uint1 PackedDecode::getNextByte(Position &pos)/// An exception is thrown of position is advanced past the end of the stream/// \param pos is the position being advanced/// \param skip is the number of bytes to advance-inline void PackedDecode::advancePosition(Position &pos,uint4 skip)+inline void PackedDecode::advancePosition(Position &pos,uint8 skip){while(pos.end - pos.current <= skip) {