vfs5011: Error out when no lines were captured

Which avoids passing zero lines to fpi_assemble_lines()

"gmem.c:130: failed to allocate 18446744073709551612 bytes"

 #3  0x00007fe4f6ef428f in g_log (log_domain=log_domain@entry=0x7fe4f6f3506e "GLib", log_level=log_level@entry=G_LOG_LEVEL_ERROR, format=format@entry=0x7fe4f6f3e610 "%s: failed to allocate %lu bytes") at gmessages.c:1398
 #4  0x00007fe4f6ef2ac4 in g_malloc0 (n_bytes=n_bytes@entry=18446744073709551612) at gmem.c:129
 #5  0x00007fe4f8052020 in median_filter (filtersize=25, size=-1, data=0x0) at assembling.c:309
 #6  fpi_assemble_lines (ctx=ctx@entry=0x7fe4f82ac3c0 <assembling_ctx>, lines=0x0, lines_len=0) at assembling.c:389
 #7  0x00007fe4f805f3db in submit_image (ssm=ssm@entry=0x16c3cba360, data=data@entry=0x16c3cb9cc0) at drivers/vfs5011.c:412

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

Closes: #42
This commit is contained in:
Bastien Nocera 2018-05-30 15:14:42 +02:00
parent dda6857fee
commit 52f84bee3c

View file

@ -400,6 +400,14 @@ void submit_image(struct fpi_ssm *ssm, struct vfs5011_data *data)
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct fp_img *img;
if (data->lines_recorded == 0) {
/* == FP_ENROLL_RETRY_TOO_SHORT */
fpi_imgdev_session_error(dev, FP_VERIFY_RETRY_TOO_SHORT);
return;
}
g_assert (data->rows != NULL);
data->rows = g_slist_reverse(data->rows);
img = fpi_assemble_lines(&assembling_ctx, data->rows, data->lines_recorded);