Skip to content

Commit

Permalink
fixed GPF on malformated TDocVariantData.InitJson() input
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Bouchez committed Apr 8, 2022
1 parent bde31d9 commit 9d929d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/mormot.core.json.pas
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ EJsonException = class(ESynException);
// - e.g. if contains " or \ characters, as defined by
// http://www.ietf.org/rfc/rfc4627.txt
function NeedsJsonEscape(const Text: RawUtf8): boolean; overload;
{$ifdef HASINLINE}inline;{$endif}

/// returns TRUE if the given text buffers would be escaped when written as JSON
// - e.g. if contains " or \ characters, as defined by
Expand All @@ -145,6 +144,7 @@ function NeedsJsonEscape(P: PUtf8Char): boolean; overload;
// - e.g. if contains " or \ characters, as defined by
// http://www.ietf.org/rfc/rfc4627.txt
function NeedsJsonEscape(P: PUtf8Char; PLen: integer): boolean; overload;
{$ifdef HASINLINE}inline;{$endif}

/// UTF-8 decode one or two \u#### JSON escaped codepoints into Dest
// - P^ should point at 'u1234' just after \u1234
Expand Down Expand Up @@ -2334,7 +2334,7 @@ TCollectionItemAutoCreateFields = class(TCollectionItem)
TSynJsonFileSettingsOptions = set of TSynJsonFileSettingsOption;

/// abstract parent class able to store settings as JSON file
// - would fallback and try to read an .INI file if no valid JSON is found
// - would fallback and try to read as INI file if no valid JSON is found
TSynJsonFileSettings = class(TSynAutoCreateFields)
protected
fInitialJsonContent: RawUtf8;
Expand Down
1 change: 1 addition & 0 deletions src/core/mormot.core.variants.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5336,6 +5336,7 @@ function TDocVariantData.InitJsonInPlace(Json: PUtf8Char;
begin
VName := nil;
VValue := nil;
exit;
end
else
VCount := n;
Expand Down
2 changes: 1 addition & 1 deletion src/mormot.commit.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'2.0.165'
'2.0.166'

0 comments on commit 9d929d3

Please sign in to comment.