This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 28d9c6b7d2c12d895bc7d78bc86848a48c633435
Author: NRK <[email protected]>
AuthorDate: Sat Jun 17 14:30:42 2023 +0600

    Y4M loader: check file size before magic check
---
 src/modules/loaders/loader_y4m.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/modules/loaders/loader_y4m.c b/src/modules/loaders/loader_y4m.c
index c64cd40..b819895 100644
--- a/src/modules/loaders/loader_y4m.c
+++ b/src/modules/loaders/loader_y4m.c
@@ -26,6 +26,7 @@ _load(ImlibImage * im, int load_data)
    int                 rc = LOAD_FAIL;
    int                 broken_image = 0;
    uint32_t           *ptr = NULL;
+   const uint8_t       magic[10] = "YUV4MPEG2 ";
 
    /* we do not support the file being loaded from memory */
    if (!im->fi->fp)
@@ -34,7 +35,8 @@ _load(ImlibImage * im, int load_data)
    /* guess whether this is a y4m file */
    const char         *fptr = im->fi->fdata;
 
-   if (strncmp(fptr, "YUV4MPEG2 ", 10) != 0)
+   if (im->fi->fsize < (int)sizeof(magic) ||
+       memcmp(fptr, magic, sizeof(magic)) != 0)
       goto quit;
 
    /* format accepted */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to