We had some read issues, so let's just use the safer reader that
makes things cleaner too
../libfprint/drivers/goodixmoc/goodix_proto.c:418:42: runtime error:
load of misaligned address 0x0000115ced29 for type 'uint16_t', which
requires 2 byte alignment
0x0000115ced29: note: pointer points here
00 c0 3f 00 21 64 1c 00 00 00 00 64 00 43 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
#0 0x7f974ff9e868 in gx_proto_parse_body ../libfprint/drivers/goodixmoc/goodix_proto.c:418
#1 0x7f974ff8ec79 in fp_cmd_receive_cb ../libfprint/drivers/goodixmoc/goodix.c:185
#2 0x7f975003ca0c in transfer_finish_cb ../libfprint/fpi-usb-transfer.c:352
#3 0x7f9756e57862 in g_task_return_now ../../glib/gio/gtask.c:1363
#4 0x7f9756e5789c in complete_in_idle_cb ../../glib/gio/gtask.c:1377
#5 0x7f97577f070b in g_main_dispatch ../../glib/glib/gmain.c:3373
#6 0x7f97577f28de in g_main_context_dispatch_unlocked ../../glib/glib/gmain.c:4224
#7 0x7f97577f28de in g_main_context_iterate_unlocked ../../glib/glib/gmain.c:4289
#8 0x7f97577f2fef in g_main_context_iteration ../../glib/glib/gmain.c:4354
#9 0x7f974fed4656 in fp_device_verify_sync ../libfprint/fp-device.c:1976
../libfprint/drivers/goodixmoc/goodix_proto.c:214:5: runtime error: null pointer passed as argument 2, which is declared to never be null
#0 0x7f378839c3e5 in gx_proto_build_package ../libfprint/drivers/goodixmoc/goodix_proto.c:214
#1 0x7f378838fd9e in alloc_cmd_transfer ../libfprint/drivers/goodixmoc/goodix.c:309
#2 0x7f378838ffe4 in goodix_sensor_cmd ../libfprint/drivers/goodixmoc/goodix.c:336
#3 0x7f378839a778 in gx_fp_template_delete_all ../libfprint/drivers/goodixmoc/goodix.c:1602
#4 0x7f37882d3d59 in fp_device_clear_storage ../libfprint/fp-device.c:1820
#5 0x7f37882d50af in fp_device_clear_storage_sync ../libfprint/fp-device.c:2132
../libfprint/drivers/goodixmoc/goodix_proto.c:111:26: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
#0 0x7f6776799c2e in reflect ../libfprint/drivers/goodixmoc/goodix_proto.c:111
#1 0x7f677679a0f3 in crc32_final ../libfprint/drivers/goodixmoc/goodix_proto.c:147
#2 0x7f677679a3ee in gx_proto_crc32_calc ../libfprint/drivers/goodixmoc/goodix_proto.c:164
#3 0x7f677679d7aa in gx_proto_init_sensor_config ../libfprint/drivers/goodixmoc/goodix_proto.c:464
#4 0x7f6776797b40 in gx_fp_init ../libfprint/drivers/goodixmoc/goodix.c:1415
#5 0x7f67766cc56e in fp_device_open ../libfprint/fp-device.c:866
#6 0x7f67766d2fd4 in fp_device_open_sync ../libfprint/fp-device.c:1872
As suggested by @benzea, the following cleanup actions have been
performed:
- let case order match enroll states enum
- remove FP_ENROLL_IDENTIFY that is no longer used
- finally use fpi_ssm_next_state instead of explicitly jumping to
FP_ENROLL_CREATE
Additionally, all types/functions/variables referring to "enroll_init"
used for FP_ENROLL_CREATE have been renamed to match "enroll_create".
All other states use similar name matching.
Signed-off-by: Enrik Berkhan <Enrik.Berkhan@inka.de>
In commit 5c28654d9 ("goodixmoc: Fix print template parsing") the length
check for the verify and duplicate check responses by requiring two
extra bytes at the end of the message.
There were also issues in other places where the length was not checked
correctly, including a scenario that could cause a read beyond the end
of the buffer.
Related: #444
Some OEM will integrate fingerprint device with powerButton. It's
possible that a user may press the power button during fingerprint
enroll or identify. This would lead to unintended PC shutdown or
hibernation. We add pwr_btn_shield cmd and related process to shield
the power button function when the fingerprint functionality (enroll and
identify) is used and restore power button function afterwards.