On 2026-10-16T08:16:23, Aristo Chen <[email protected]> wrote:
> test: py: cover invalid external data properties in fit_import_data()
>
> Build an external-data FIT, then point one image's data-offset far past
> the end of the file and, separately, make its data-size run a few bytes
> past the end, re-processing the result with mkimage -F each time. Both
> must be rejected with a diagnostic naming that image. Previously the
> first crashed mkimage and the second silently imported the bytes beyond
> the end of the file as image data.
>
> Also check that a FIT whose images are all empty, which mkimage -E -p
> writes with data-position past the end of the file, still re-processes,
> since an empty region has nothing to read.
>
> Finally, check that a data-offset or data-size that is not exactly one
> cell is skipped like a missing property, so that mkimage finds no data
> for the image and fails. fdtdec_get_int() already ignored an empty
> property, so that case covers the length check the import now relies on
> in the accessors. A property of two cells used to be imported from its
> first cell, so that <0 0> made the image use another image's data or
> left it empty.
>
> While at it, correct the comment in
> test_fit_import_data_missing_offset(), which said that the hashing stage
> reports the skipped image. mkimage stops before that stage, in the
> cipher pass, which runs first and fetches the data of every image.
>
> Signed-off-by: Aristo Chen <[email protected]>
>
>  test/py/tests/test_fit_import_data.py | 96 
> ++++++++++++++++++++++++++++++++++-
>  1 file changed, 94 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to