Skip to content

Commit

Permalink
Fix some more seg-faults on encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoodsend committed Feb 12, 2022
1 parent 50e343b commit 080744d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ultrajsonenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ static FASTCALL_ATTR INLINE_PREFIX void FASTCALL_MSVC Buffer_AppendShortHexUnche

static int Buffer_EscapeStringUnvalidated (JSONObjectEncoder *enc, const char *io, const char *end)
{
Buffer_Reserve(enc, RESERVE_STRING(end - io) + 1);
char *of = (char *) enc->offset;

for (;;)
Expand Down Expand Up @@ -279,7 +280,7 @@ static int Buffer_EscapeStringUnvalidated (JSONObjectEncoder *enc, const char *i

static int Buffer_EscapeStringValidated (JSOBJ obj, JSONObjectEncoder *enc, const char *io, const char *end)
{
Buffer_Realloc(enc, RESERVE_STRING(end - io));
Buffer_Reserve(enc, RESERVE_STRING(end - io) + 1);

JSUTF32 ucs;
char *of = (char *) enc->offset;
Expand Down Expand Up @@ -729,7 +730,7 @@ static void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, size_t c
if (count > 0) {
// Reserve space for the indentation plus the newline and the closing
// bracket.
Buffer_Reserve (enc, enc->indent * enc->level + 2);
Buffer_Reserve (enc, enc->indent * enc->level + 5);
Buffer_AppendIndentNewlineUnchecked (enc);
Buffer_AppendIndentUnchecked (enc, enc->level);
}
Expand Down

0 comments on commit 080744d

Please sign in to comment.