Skip to content

Commit

Permalink
oss-fuzz 44151: pdfi_TJ() hold a local, ref counted reference
Browse files Browse the repository at this point in the history
to the operand array, in case an error causes the op stack reference to it to
disappear, and the object to be freed while we're still using it.
  • Loading branch information
chris-liddell committed Jan 29, 2022
1 parent cd92dea commit 85fa6e1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pdf/pdf_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,6 @@ static int pdfi_show_set_params(pdf_context *ctx, pdf_string *s, gs_text_params_
}
text->size = s->length;
}
else {
code = gs_note_error(gs_error_invalidfont);
goto text_params_error;
}
return 0;

text_params_error:
Expand Down Expand Up @@ -1201,6 +1197,8 @@ int pdfi_TJ(pdf_context *ctx)
pdfi_pop(ctx, 1);
return gs_note_error(gs_error_typecheck);
}
pdfi_countup(a);
pdfi_pop(ctx, 1);

/* Save the CTM for later restoration */
saved = ctm_only(ctx->pgs);
Expand Down Expand Up @@ -1312,7 +1310,7 @@ int pdfi_TJ(pdf_context *ctx)
ctx->pgs->line_params.half_width = linewidth;

exit:
pdfi_pop(ctx, 1);
pdfi_countdown(a);
return code;
}

Expand Down

0 comments on commit 85fa6e1

Please sign in to comment.