From dda6857feef60694dac1493b3860a64e4fa5f8f3 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 30 May 2018 15:11:49 +0200 Subject: [PATCH] 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 --- libfprint/assembling.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libfprint/assembling.c b/libfprint/assembling.c index 7b9fb79..de8cb34 100644 --- a/libfprint/assembling.c +++ b/libfprint/assembling.c @@ -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;