From 7f6ab61292ac7950e68aa58664956d97fe0e23f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 14 Jul 2022 21:14:29 +0200 Subject: [PATCH] fp-device: Return an error if prints are invalid We'd crash later otherwise, while it's better to return an error. --- libfprint/fp-device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c index b94f7d80..0d79fae1 100644 --- a/libfprint/fp-device.c +++ b/libfprint/fp-device.c @@ -1400,6 +1400,14 @@ fp_device_identify (FpDevice *device, return; } + if (prints == NULL) + { + g_task_return_error (task, + fpi_device_error_new_msg (FP_DEVICE_ERROR_DATA_INVALID, + "Invalid gallery array")); + return; + } + priv->current_action = FPI_DEVICE_ACTION_IDENTIFY; priv->current_task = g_steal_pointer (&task); setup_task_cancellable (device);