On 2026-10-11T15:21:13, Aristo Chen <[email protected]> wrote: > test: py: keep the external payload when editing a FIT with fdtput > > test_fit_import_data_missing_offset() builds an external-data FIT and > removes one image's data-offset with fdtput. fdtput rewrites only the > device tree, so the external payload behind it is dropped and the file > shrinks to the bare FIT. The test still passed, but only because > fit_import_data() reads the remaining image's data from beyond the end > of the truncated file, which on Linux lands in the zero-filled rest of > the mapped page rather than crashing. A bounds check on those reads, > added next, rejects that image first and the test would stop > exercising the case it was written for. > > Add a helper that saves the payload before running fdtput and appends > it again afterwards at the 4-byte alignment fit_import_data() expects, > and use it in the test so that the edited FIT stays complete. > > Signed-off-by: Aristo Chen <[email protected]> > > test/py/tests/test_fit_import_data.py | 30 ++++++++++++++++++++++++++++-- > 1 file changed, 28 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <[email protected]>
