Commit Graph

20 Commits

Author SHA1 Message Date
Richard Hughes
52441f28a4 Allow objects to deserialize to XML
This makes a lot more sense; we can parse a firmware and export the same XML
we would use in a .builder.xml file. This allows us to two two things:

 * Check we can round trip from XML -> binary -> XML

 * Using a .builder.xml file we can check ->write() is endian safe
2021-03-15 12:07:30 +00:00
Richard Hughes
2667e4bdc1 synaptics-rmi: Never create a zero-sized v10 container 2021-03-10 21:00:18 +00:00
Richard Hughes
b86eac9034 synaptics-rmi: Write files with valid checksum data 2021-03-10 19:18:28 +00:00
Richard Hughes
1981c63d58 Remove FuFirmwareImage and just use FuFirmware instead
This allows us to 'nest' firmware formats, and removes a ton of duplication.

The aim here is to deprecate FuFirmwareImage -- it's almost always acting
as a 'child' FuFirmware instance, and even copies most of the vfuncs to allow
custom types. If I'm struggling to work out what should be a FuFirmware and
what should be a FuFirmwareImage then a plugin author has no hope.

For simple payloads we were adding bytes into an image and then the image into
a firmware. This gets really messy when most plugins are treating the FuFirmware
*as* the binary firmware file.

The GBytes saved in the FuFirmware would be considered the payload with the
aim of not using FuFirmwareImage in the single-image case.
2021-03-09 21:14:12 +00:00
Richard Hughes
54bc512388 Add firmware flags for presence of CRC and VID/PID 2021-02-11 20:27:20 +00:00
Richard Hughes
a45d807a08 synaptics-rmi: Limit the number of containers to a sane value
Using hongfuzz we managed to build a valid firmware with 246625043 containers,
which took over 60 seconds to parse.
2021-02-10 15:27:42 +00:00
Richard Hughes
84176c9e1a synaptics-rmi: Be more careful when parsing invalid firmware 2021-02-10 15:27:42 +00:00
Richard Hughes
b0cf709f9b synaptics-rmi: Fix a memory leak when parsing invalid firmware 2021-02-10 15:27:42 +00:00
Richard Hughes
edc0c08065 synaptics-rmi: Support parsing and writing signed firmware
Validate the firmware signature if provided
2021-01-18 21:18:02 +00:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
e002f21066 trivial: Prevent a crash when parsing corrupt RMI firmware
Using fu_common_bytes_new_offset() is much safer as it checks the source size.
2021-01-06 10:08:45 +00:00
Richard Hughes
64e9f6bd92 trivial: Fix up some NULL/FALSE confusion 2021-01-04 16:32:50 +00:00
Richard Hughes
c2a0259fe6 Remove now-unused synaptics_rmi_dump fuzzing target generator
We can implement firmware->build and firmware->write and then use the shared
firmware.builder.xml functionality.
2021-01-04 15:42:17 +00:00
Richard Hughes
bfabf5c81f synaptics-rmi: Do not add zero sized container images
This prevents a DoS when parsing corrupt firmware.
2020-12-10 14:58:11 +00:00
Richard Hughes
056dfff741 synaptics-rmi: Fix possible buffer over-read for corrupt firmware 2020-12-09 15:25:04 +00:00
Richard Hughes
c79e76d2aa synaptics-rmi: Fix a tiny memory leak when parsing firmware 2020-12-08 20:07:27 +00:00
Richard Hughes
a2a8f8ea70 Add fu_byte_array_set_size()
The GLib g_byte_array_set_size() function does not zero the contents if the
array size is larger, which leads to unpredictable output when using valgrind.
2020-10-20 19:54:07 +01:00
Richard Hughes
6450d0deb4 Add FwupdInstallFlags of _IGNORE_CHECKSUM, _IGNORE_VID_PID and _IGNORE_POWER
The FWUPD_INSTALL_FLAG_FORCE flag has really unclear semantics, and ignoring a
file CRC, checksum or model ID should only be done when using fwupdtool actually
debugging a plugin or firmware parser.

Use the existing --force flag when we want a "gentle nudge" like reuploading
previously processed reports.
2020-10-07 13:15:09 +01:00
Richard Hughes
47862828e1 trivial: Allow setting an ID of NULL for the FuFirmwareImage
There's no reason to prevent NULL, and doing so means the caller has to check
before setting the value. Only one subclassed type was actually doing this...
2020-01-16 11:24:55 -06:00
Richard Hughes
63aa6759f0 Add a plugin to update Synaptics RMI4 devices 2019-10-02 10:45:13 +01:00