diff options
author | Pali Rohár | 2023-01-29 17:45:55 +0100 |
---|---|---|
committer | Tom Rini | 2023-02-06 14:35:14 -0500 |
commit | afd82187b549e3bebc2ae02dc2914f8a43418ec4 (patch) | |
tree | 3676a07c35c376afc24c8bb0a27ad1b330dddc1b /tools/imagetool.c | |
parent | 6c58aa1e6167ab71d4d4121cd79372bf25d1792a (diff) |
tools: imagetool: Skip autodetection of gpimage type
gpimage type requires only that two first 32-bit words of data file are
non-zero. So basically every random data file can be guessed and verified
as gpimage. So completely skip gpimage type from image autodetection code
to prevent lot of false positive results. Data file with gpimage type can
be still verified and parsed by explicitly specifying -T gpimage.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/imagetool.c')
-rw-r--r-- | tools/imagetool.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/imagetool.c b/tools/imagetool.c index e1021f44f5a..87eee4ad04e 100644 --- a/tools/imagetool.c +++ b/tools/imagetool.c @@ -49,6 +49,12 @@ int imagetool_verify_print_header( return imagetool_verify_print_header_by_type(ptr, sbuf, tparams, params); for (curr = start; curr != end; curr++) { + /* + * Basically every data file can be guessed / verified as gpimage, + * so skip autodetection of data file as gpimage as it does not work. + */ + if ((*curr)->check_image_type && (*curr)->check_image_type(IH_TYPE_GPIMAGE) == 0) + continue; if ((*curr)->verify_header) { retval = (*curr)->verify_header((unsigned char *)ptr, sbuf->st_size, params); |