Rather than just do it in production if set, make it more difficult to
potentially inject the test mode.
So rely on a weak definition of fpi_device_emulation_mode_enabled() that
can be only set externally
Drivers may do some adjustments in test mode, initially we wanted to
reduce this to the minimum but the usage of `FP_DEVICE_EMULATION`
exploded, so move this instead into a properly defined variable that:
- Uses GLib compiler optimizations
- Is read just once per process
- Cannot be misused
As per commit bad930503c the test data is way bigger than it used to
be, so the test duration is longer.
Thus increase the timeout not to have failures
DT_RUNPATH is intentionally searched after $LD_LIBRARY_PATH.
-Wl,--disable-new-dtags switches to the old DT_RPATH tag, which is searched
before $LD_LIBRARY_PATH. So the embedded paths in the build binary will now
win over whatever is in the environment.
Not breaking builds.
Use bounded uid strings for template-info handling.
- stop printing fixed-size device buffers with raw %s
- use g_strndup(..., TEMPLATE_UID_SIZE) before logging tpl_info.uid
- compare delete target uid against the bounded copy
- log handshake response as bytes instead of %s
This avoids over-read/invalid-UTF8 issues when unknown/corrupted entries
contain non-NUL or 0xff-filled uid data.
../libfprint/drivers/uru4000.c:743:35: runtime error: left shift of 138 by 24
places cannot be represented in type 'int'
#0 0x7fa3e696e06d in imaging_run_state ../libfprint/drivers/uru4000.c:743
#1 0x7fa3e6a366f6 in __ssm_call_handler ../libfprint/fpi-ssm.c:254
#2 0x7fa3e6a38cc8 in fpi_ssm_next_state ../libfprint/fpi-ssm.c:465
#3 0x7fa3e696bd07 in sm_read_reg_cb ../libfprint/drivers/uru4000.c:515
#4 0x7fa3e6a3db74 in transfer_finish_cb ../libfprint/fpi-usb-transfer.c:352
#5 0x7fa3ed9b9862 in g_task_return_now ../../glib/gio/gtask.c:1363
#6 0x7fa3ed9b989c in complete_in_idle_cb ../../glib/gio/gtask.c:1377
#7 0x7fa3ede4a70b in g_main_dispatch ../../glib/glib/gmain.c:3373
#8 0x7fa3ede4c8de in g_main_context_dispatch_unlocked ../../glib/glib/gmain.c:4224
#9 0x7fa3ede4c8de in g_main_context_iterate_unlocked ../../glib/glib/gmain.c:4289
#10 0x7fa3ede4cfef in g_main_context_iteration ../../glib/glib/gmain.c:4354
#11 0x7fa3e68d4a1b in fp_device_capture_sync ../libfprint/fp-device.c:2048
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
This is was leading to a potential error due to misaligned memory:
../libfprint/drivers/goodixmoc/goodix.c:167:20: runtime error: load of
misaligned address 0x00001165c989 for type 'uint32_t', which requires 4 byte
alignment
0x00001165c989: note: pointer points here
00 00 00 00 0a ac b3 09 00 00 00 00 00 00 55 53 42 00 00 00 00 00 56 42 53 00 00 00 00 00 30 30
^
#0 0x7ff3ba98d190 in fp_cmd_receive_cb ../libfprint/drivers/goodixmoc/goodix.c:167
#1 0x7ff3baa3b235 in transfer_finish_cb ../libfprint/fpi-usb-transfer.c:352
#2 0x7ff3c18ca862 in g_task_return_now ../../glib/gio/gtask.c:1363
#3 0x7ff3c18ca89c in complete_in_idle_cb ../../glib/gio/gtask.c:1377
#4 0x7ff3c228470b in g_main_dispatch ../../glib/glib/gmain.c:3373
#5 0x7ff3c22868de in g_main_context_dispatch_unlocked ../../glib/glib/gmain.c:4224
#6 0x7ff3c22868de in g_main_context_iterate_unlocked ../../glib/glib/gmain.c:4289
#7 0x7ff3c2286fef in g_main_context_iteration ../../glib/glib/gmain.c:4354
#8 0x7ff3ba8d2fe5 in fp_device_open_sync ../libfprint/fp-device.c:1874