FIX: SevenZip - heap corruption

(cherry picked from commit 7c1296856c)
This commit is contained in:
Alexander Koblov 2023-08-15 19:48:22 +03:00
commit fbdf8e6938
2 changed files with 6 additions and 0 deletions

View file

@ -113,6 +113,7 @@ function ReadStringProp(FormatIndex: Cardinal; PropID: TPropID;
var
PropValue: TPropVariant;
begin
PropValue.vt:= VT_EMPTY;
Result:= Succeeded(GetHandlerProperty2(FormatIndex, PropID, PropValue));
Result:= Result and (PropValue.vt = VT_BSTR);
if Result then
@ -129,6 +130,7 @@ function ReadBooleanProp(FormatIndex: Cardinal;
var
PropValue: TPropVariant;
begin
PropValue.vt:= VT_EMPTY;
Result:= Succeeded(GetHandlerProperty2(FormatIndex, PropID, PropValue));
Result:= Result and (PropValue.vt = VT_BOOL);
if Result then Value:= PropValue.boolVal;
@ -150,6 +152,7 @@ begin
SetLength(ArchiveFormats, NumberOfFormats);
for Index := Low(ArchiveFormats) to High(ArchiveFormats) do
begin
PropValue.vt:= VT_EMPTY;
// Archive format GUID
if Succeeded(GetHandlerProperty2(Index, kClassID, PropValue)) then
begin
@ -165,6 +168,7 @@ begin
VarStringClear(PropValue);
end;
end;
PropValue.vt:= VT_EMPTY;
// Archive format signature
if Succeeded(GetHandlerProperty2(Index, kStartSignature, PropValue)) then
begin

View file

@ -180,6 +180,7 @@ function GetCoderInfo(GetMethodProperty: TGetMethodProperty; Index: UInt32; var
var
Value: TPropVariant;
begin
Value.vt:= VT_EMPTY;
if (GetMethodProperty(Index, kDecoder, Value) <> S_OK) then
Exit(False);
if (Value.vt <> VT_EMPTY) then
@ -220,6 +221,7 @@ begin
Exit(False);
AInfo.ID:= Value.uhVal.QuadPart;
Value.vt:= VT_EMPTY;
if (GetMethodProperty(Index, kName, Value) <> S_OK) then
Exit(False);
if (Value.vt = VT_BSTR) then