Marco Trevisan (Treviño)
657c764b73
uru4000: Ensure we do not overflow image buffer on reading
...
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
ad8a6f6b17
uru4000: Prevent a buffer overflow on reading the device image data
...
num_lines comes from the device for each block and is summed into
the source row index (r) and destination byte offset (to).
Neither the per-block value nor the running totals are otherwise bound,
so a malicious device could drive the copy past the source
(IMAGE_HEIGHT rows) or destination buffer.
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
63be3884d6
etes603: Handle buffer over/under-flows
...
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
c025abcd15
fpc: Prevent overflow when reading the print identity
...
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
3cc0ae79e7
fpc: Prevent a buffer-overflow on data reading
...
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
092c0dfc31
fpcmoc: Copy the error before sending to the SSM
...
The SSM error is stolen and then we pass to the resume/suspend callback
potentially leading to a double-free.
So copy it before re-using it.
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
3138ad0c8a
goodixmoc: Cleanup the byte reader usage
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
0c0baf639e
goodixmoc: Ensure we do not overflow when reading the payload
...
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
f15a62b5aa
goodixmoc: Handle invalid finger number
...
A modified device may supply invalid data, leading to libfprint crashes
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
d9374963cd
goodixmoc: Handle cases in which the header lenght is smaller than CRC size
...
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
19719bf2da
goodixmoc: Add missing return on CRC failure
...
Reported by: Keith Linneman (LinnemanLabs)
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
11b8930d35
fpi-device: Fix device action error docstring and transfer
2026-07-13 08:13:46 +00:00
Marco Trevisan (Treviño)
5597082804
uncrustify: Add g_autolist and g_autoslist to auto types
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
dac36a8d59
fp-device: Fix double free in device finalization with pending timeout sources
...
fp_device_finalize calls g_slist_free_full() to destroy any still-pending
timeout sources.
Each g_source_destroy call triggers timeout_finalize, which tries to
remove the current source from the sources list.
This may lead to a double-free, as iterating over a list deleting items
is not supported.
Add a regression test that adds a timeout with a long delay and immediately
finalizes the device while the timeout is still pending.
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
55b934b02e
tests/fpi-device: Increase warmup/cooldown test timeouts
...
The slack of 250ms wasn't enough on loaded CI systems, causing frequent
flaky failures (e.g. 2276ms actual vs 2250ms limit, or 2294ms vs 2250ms).
Double the slacks to 500ms for the 2s transitions and 1000ms for the
5s transition to absorb system load noise while still catching real
timing regressions.
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
3cae9ea4ae
build/tests: Add ability to define more per-test meson parameters
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
a1713fab6b
synaptics: Fix a comment typo
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
18f60cb47f
fpi-device: Improve logging on driver reported data
...
And perform data allocations only if debug logging is enabled
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
ebcab4ac1a
fp-device: Use GLib API to deep copy the prints gallery
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
91dd69475f
tests/fpi-device: Add test identifying with an empty gallery
...
We're still going into the device in this case because technically the
identify operation may still return a print, although never a match of
course.
Adding tests so that we are not tempted to modify the behavior of the
identify function to return an error on prints->len == 0 or to just not
call the driver on such case.
2026-07-12 13:17:35 +02:00
Marco Trevisan (Treviño)
7e579f0f36
fpi-device: Warn if a device returns a scanned print that is not matching match
...
Devices can scan even without a match, but if they do match a print then
they must match.
Ensure this in code to prevent drivers to return inconsistent data.
2026-07-12 13:17:34 +02:00
Marco Trevisan (Treviño)
2f6b46b91f
tests-fpi-device: Do not hardcode the gallery random pick limit
2026-07-12 13:16:33 +02:00
Marco Trevisan (Treviño)
b4d78e7c0f
fpi-print: Add function to check if two prints match
...
While for raw prints this is just an equality check, for NBIS prints
they match if at least one of the minutiae match
2026-07-12 13:16:33 +02:00
Marco Trevisan (Treviño)
3ac3c7b082
tests-fpi-device: Add unit tests for prints equality
2026-07-12 13:16:33 +02:00
Marco Trevisan (Treviño)
7730146af0
fp-print: Just consider equal prints pointers to be equal
2026-07-12 13:16:33 +02:00
Marco Trevisan (Treviño)
7e3453e796
fpi-device: Do not potentially leak a nested error
2026-07-12 13:16:33 +02:00
Marco Trevisan (Treviño)
cb862ccfad
fpi-device: Remove commented function
2026-07-12 13:16:33 +02:00
Marco Trevisan (Treviño)
c5e49592cd
drivers: Remove redundant verify implementations
...
As per recent changes, drivers can just avoid implementing verify vfunc
unless the driver has specific commands to do it.
So let's just drop the duplicated code in drivers that have the very
same code path for both identification and verification.
2026-07-12 12:58:52 +02:00
Marco Trevisan (Treviño)
bebaa80c99
fp-image-device: Drop explicit verification support
...
It's just the same logic repeated across one or multiple templates, so
let's just define one
2026-07-12 12:58:52 +02:00
Marco Trevisan (Treviño)
7fee92884d
fp-device: Implement verify using identification
...
In case a device has not support for verification through an explicit
verify function, the verification can still be implemented using
identification with a gallery of a single print.
In fact that's what most of drivers these days do it, so let's just
avoid to them to handle this duplication unless a driver has really some
specific commands to do it.
2026-07-12 12:58:50 +02:00
Marco Trevisan (Treviño)
0e64435628
focaltech_moc: Simplify interface claiming error handling
2026-07-02 13:18:26 +02:00
Marco Trevisan (Treviño)
3c4bee9e82
ci: Add test build in s390x to verify BE behavior
...
Most of drivers supports both endiannesses but we do not test this so
let's add a CI job to verify this
2026-07-02 02:14:37 +02:00
Marco Trevisan (Treviño)
72188c0eb8
aes2501: Fix endianness of instogram
2026-07-02 02:14:37 +02:00
Marco Trevisan (Treviño)
141a63b0a4
egis_etu905: Use fpi writer to build the commit data
2026-07-01 17:59:34 +02:00
Marco Trevisan (Treviño)
a042240b67
egis_etu905: Use little endian commit data in all the archs
2026-07-01 17:56:41 +02:00
Marco Trevisan (Treviño)
1d6ebb0ee8
uru4000: Fix computation of num lines in big endian
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
e2ff73df3f
elan: Use guint16 in LE for frame value
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
e821d0f83f
build: Enable elanspi in big endian archs
...
It works fine so no need to do anything there
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
2ff99be5db
goodixmoc: Fix handling of CRC32 in big endian archs
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
2dec3f57ea
mafpmoc: Use fpi-bytes-writer to build command packet
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
5395d1d2c5
elanspi: Include fcntl properly
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
10c0b68549
mafpmoc: Copy the most significant bit of the cmd instead of LSB
...
This was causing the command not to be properly used in big endian archs
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
47583db988
build: Do not mark secugen endian-dependent
...
The driver works fine in big endian machine
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
050476e1ba
fpcmoc: Use fpi-byte-{reader,writer} to parse/build the device data
...
In this way we have not endianness limitations
2026-07-01 17:49:34 +02:00
Marco Trevisan (Treviño)
c039ab4754
fpcmoc: Add support to big endian architecture
2026-07-01 14:36:08 +02:00
Marco Trevisan (Treviño)
3e04f15179
build: Use a dict to define drivers build info
...
We used multiple arrays, making things more complicated than we should
with current meson
2026-07-01 14:00:56 +02:00
Marco Trevisan (Treviño)
accbf7828e
virtual-device: Set the finger on the new scanned prints
2026-06-26 13:44:02 +02:00
Marco Trevisan (Treviño)
1fd4024bd0
fp-print: Rely on GBytes to align memory
...
The old workaround is not needed anymore for the GLib version we're
depending on
2026-06-26 13:44:02 +02:00
Marco Trevisan (Treviño)
2d4b1c39e0
virtual-device: Use newer GLib functions
2026-06-26 13:44:02 +02:00
Marco Trevisan (Treviño)
5dbcb0dfa4
fpi-{usb,spi}: Adjust docs to mention required env variables for logging
2026-06-22 15:22:04 +02:00
Marco Trevisan (Treviño)
3a54e4f837
fpi-log: Add atomic and unique check for FP_DEBUG_TRANSFER
...
Rather than check it all the times the variable, just rely on an atomic
check that is just done once for all
2026-06-22 15:22:04 +02:00
Marco Trevisan (Treviño)
8009a86247
fpi-log: Use single-line hex bytes dump
...
It's easier to parse and copy and also it makes easier to use it with
tools such as python's bytes.fromhex() without reformatting it.
2026-06-22 15:19:30 +02:00
Marco Trevisan (Treviño)
3db8184a30
fpi-log: Add functions to dump bytes
...
Drivers may need to to hex-dumps for debugging purposes, so expose what
we already had in the fpi transfers in the internal API
2026-06-22 15:19:30 +02:00
Marco Trevisan (Treviño)
5cadc90e7a
fpi-ssm: Add checks on parameters validity
2026-06-22 12:50:16 +02:00
Marco Trevisan (Treviño)
d1194070b1
fpi-ssm: Fix typo on docs
2026-06-22 12:49:50 +02:00
Marco Trevisan (Treviño)
92b7ced91c
fpi-ssm: Clarify errors ownership
2026-06-22 12:49:28 +02:00
Marco Trevisan (Treviño)
3d91527eb9
secugen: Ignore wrong and unneeded device emulation mode check
2026-06-19 16:09:11 +02:00
Marco Trevisan (Treviño)
5c6fcb8f00
build: Define variable early enough
2026-06-19 16:08:52 +02:00
Marco Trevisan (Treviño)
f800bbd485
fpi-device: Get the emulation mode only through compile-time defined libs
...
In test mode, dynamically load libraries in well known locations that can
allow to override the libfprint behavior.
It would still be possible to potentially inject code by replicating the
distro build directory and adding a library there, but if one is able to
access there, they would already be able to access any path.
Plus the env variable check is still there, so again they would need to
be able to change the fprintd environment
2026-06-19 15:55:13 +02:00
Marco Trevisan (Treviño)
3933e5d468
fpi-device: Only use emulation mode by pre-loading a library
...
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
2026-06-19 15:50:18 +02:00
Marco Trevisan (Treviño)
98fb001883
fpi-device: Introduce a properly defined fpi_device_emulation_mode_enabled()
...
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
2026-06-19 15:43:45 +02:00
Marco Trevisan (Treviño)
debc6c601e
fp-print: Use a switch to match the print type
2026-06-19 15:43:45 +02:00
Marco Trevisan (Treviño)
59ecce0a99
virtual-device: Use consistent sleep/wait multiplier under valgrind
2026-06-19 15:43:09 +02:00
Marco Trevisan (Treviño)
b587e78b09
test-utils: Do not include the header multiple times
2026-06-19 15:43:09 +02:00
Marco Trevisan (Treviño)
2373769e5b
tests/build: Increase the focaltech_moc test timeout
...
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
2026-06-19 15:43:09 +02:00
Marco Trevisan (Treviño)
bf91b0ede8
tests/build: Allow to define per-test parameters via a dict
2026-06-19 15:43:09 +02:00
Marco Trevisan (Treviño)
7925c5af13
drivers-api: Add fpi-enums header
2026-06-19 15:37:34 +02:00
Marco Trevisan (Treviño)
71d4c9e7e4
build: Use files to track drivers files
...
While it's not much needed to ensure rebuild on changes, it may be
useful to get the drivers paths in future
2026-06-19 15:37:34 +02:00
Marco Trevisan (Treviño)
f0d4a8830b
libfprint/build: Ignore LD_LIBRARY_PATH (and use rpath) on local binaries
...
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.
2026-06-19 15:37:34 +02:00
Marco Trevisan (Treviño)
9e59d69271
fprint-list-metainfo: Write errors messages to stderr by default
...
So logging won't affect the result
2026-06-19 12:10:33 +02:00
Marco Trevisan (Treviño)
6498a64f3a
tests/hwdb: Use all hwdb-related variables for that test only
2026-06-19 12:10:33 +02:00
Marco Trevisan (Treviño)
bfa74c2816
ci: Do not fail on coverage report page publication
2026-06-19 12:05:29 +02:00
Marco Trevisan (Treviño)
ba5a6a9447
focaltech_moc: Check transfer lengths
2026-06-18 18:10:39 +02:00
Marco Trevisan (Treviño)
169d9addc9
focaltech_moc: Do not set delete feature for 6553
2026-06-18 18:10:39 +02:00
Marco Trevisan (Treviño)
4e92d67048
mafpmoc: bound tpl_info uid usage in logs
...
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.
2026-06-18 15:49:29 +02:00
Marco Trevisan (Treviño)
4eea5c5e17
mafpmoc: Add various memory cleanups and hardenings
2026-06-18 15:49:27 +02:00
Marco Trevisan (Treviño)
4f743766a5
mafpmoc/custom: Improve test script checking for identified match
2026-06-18 15:49:25 +02:00
Marco Trevisan (Treviño)
c1bb621b59
mafpmoc: Fix error handling
2026-06-18 15:49:23 +02:00
Marco Trevisan (Treviño)
3e300ae7ae
mapfmoc: Do not use reserved FP prefix for driver types
2026-06-18 15:49:22 +02:00
Marco Trevisan (Treviño)
7df9fc18cf
mafpmoc: Use consistent error handling and fix some leaks
2026-06-18 15:49:20 +02:00
Marco Trevisan (Treviño)
14d40fb515
mafpmoc: Code cleanups
2026-06-18 15:49:16 +02:00
Marco Trevisan (Treviño)
a4eb3013da
mafpmoc: Init the device enroll stage at class init
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
77b73b04b4
mafpmoc: Allow listing non-fprint prints
...
It's then up to the upper levels to handle them differently, and fprintd
is already strong enough to ignore them.
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
5a2762fe17
mafpmoc: Cleanup handling of identify and matching prints
...
Make clearer the ownership of the prints we're tracking
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
147f3db814
mafpmoc: Ensure the current task SSM reference is always cleaned up
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
3cbeb34d36
libfprint/fprint-list-udev-hwdb: Drop mafpmoc from unsupported list
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
4be0fc60a4
mafpmoc: Init print id value
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
893003799d
mafpmoc: Ignore prints not enrolled by FPrint when listing them
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
b25cbff9be
mafpmoc: Do not compare differently signed values
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
b141eca270
mafpmoc: Handle cancellation without overriding the error
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
95ecaa156d
mafpmoc: Improve creation and destruction of templates list
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
3ce345b876
mafpmoc: Do not pack templates structure
...
Otherwise undefined sanitizer would fail for unaligned memory access
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
b3ad630fb4
mafpmoc: Steal errors when forwarding their ownerships
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
8d81299743
mafpmoc: Clear errors when they are not forwarded
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
67649a0efd
pafpmoc: Drop check on fprintd templates
...
It's not up to the drivers do do this check
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
bbd4ca2fdf
mafpmoc: Cleanup code
2026-06-18 15:47:34 +02:00
Marco Trevisan (Treviño)
5b01f0b7c1
secugen: Do image processing inside GTask threads
...
Do not block the main loop to process image data
2026-06-17 19:47:24 +02:00
Marco Trevisan (Treviño)
4a7842347e
secugen: Use autopointers
2026-06-17 19:47:24 +02:00
Marco Trevisan (Treviño)
0c34a2b888
secugen: Use device timeout rather than a custom one
2026-06-17 19:47:23 +02:00
Marco Trevisan (Treviño)
3af57e3483
secugen: Check transfers have a minimal lengths
2026-06-17 19:47:23 +02:00