assembling: Add guards to fpi_assemble_lines()

With the goal of not crashing when we try to malloc MAXINT bytes of RAM.

See https://bugzilla.redhat.com/show_bug.cgi?id=1484812

Closes: #42
This commit is contained in:
Bastien Nocera 2018-05-30 15:11:49 +02:00
parent 0215483fb3
commit dda6857fee

View file

@ -365,6 +365,9 @@ struct fp_img *fpi_assemble_lines(struct fpi_line_asmbl_ctx *ctx,
unsigned char *output = g_malloc0(ctx->line_width * ctx->max_height);
struct fp_img *img;
g_return_val_if_fail (lines != NULL, NULL);
g_return_val_if_fail (lines_len > 0, NULL);
fp_dbg("%"G_GINT64_FORMAT, g_get_real_time());
row1 = lines;