upeksonly: Fix possible division by zero in upeksonly_get_deviation2()
By asserting if we have a zero line width. libfprint/drivers/upeksonly.c:118:7: warning: Division by zero mean /= (ctx->line_width / 2); ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
6845e400cd
commit
9a025bde8b
1 changed files with 3 additions and 0 deletions
|
@ -112,6 +112,9 @@ static int upeksonly_get_deviation2(struct fpi_line_asmbl_ctx *ctx,
|
|||
{
|
||||
unsigned char *buf1 = line1->data, *buf2 = line2->data;
|
||||
int res = 0, mean = 0, i;
|
||||
|
||||
g_assert (ctx->line_width > 0);
|
||||
|
||||
for (i = 0; i < ctx->line_width; i+= 2)
|
||||
mean += (int)buf1[i + 1] + (int)buf2[i];
|
||||
|
||||
|
|
Loading…
Reference in a new issue