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 0b08655e40777e6d8573397bd3dffd4449be339a
Author: Chema Gonzalez <che...@meta.com>
AuthorDate: Tue Aug 15 14:21:48 2023 -0700

    Y4M loader: add support for images with unexpected aspects
    
    Tested:
    
    Added a new test case with an unknown aspect (A368:375).
---
 src/modules/loaders/loader_y4m.c           | 10 ++++++----
 test/images/icon-64.aspect_unsupported.y4m |  3 +++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/modules/loaders/loader_y4m.c b/src/modules/loaders/loader_y4m.c
index ce23cb2..2b11f63 100644
--- a/src/modules/loaders/loader_y4m.c
+++ b/src/modules/loaders/loader_y4m.c
@@ -67,6 +67,7 @@ typedef struct {
       Y4M_PARSE_ASPECT_4_3,
       Y4M_PARSE_ASPECT_4_5,
       Y4M_PARSE_ASPECT_32_27,
+      Y4M_PARSE_ASPECT_OTHER,
    } aspect;
 
    const void         *frame_data;
@@ -199,7 +200,11 @@ y4m__parse_params(Y4mParse * res, const uint8_t ** start, const uint8_t * end)
              else if (y4m__match("32:27", 5, &p, end))
                 res->aspect = Y4M_PARSE_ASPECT_32_27;
              else
-                return Y4M_PARSE_CORRUPTED;
+               {
+                  res->aspect = Y4M_PARSE_ASPECT_OTHER;
+                  for (; p < end && *p != ' ' && *p != '\n'; ++p)
+                     ;
+               }
              break;
           case 'X':            /* comments ignored */
              for (; p < end && *p != ' ' && *p != '\n'; ++p)
@@ -368,9 +373,6 @@ _load(ImlibImage * im, int load_data)
    // no interlacing support
    if (y4m.interlacing != Y4M_PARSE_IL_PROGRESSIVE)
       return LOAD_BADIMAGE;
-   // treat unknown and default as 1:1 similar to ffmpeg
-   if (y4m.aspect > Y4M_PARSE_ASPECT_1_1)       /* no support for non 1:1 */
-      return LOAD_BADIMAGE;
 
    im->w = y4m.w;
    im->h = y4m.h;
diff --git a/test/images/icon-64.aspect_unsupported.y4m b/test/images/icon-64.aspect_unsupported.y4m
new file mode 100644
index 0000000..17457a6
--- /dev/null
+++ b/test/images/icon-64.aspect_unsupported.y4m
@@ -0,0 +1,3 @@
+YUV4MPEG2 W64 H64 F25:1 Ip A368:375 C444 XYSCSS=444 XCOLORRANGE=LIMITED
+FRAME
+�������������������������뻗�h]]]\[���������������������������������������������������ǂ_DIJHHGFEDA=83/Cq������������������������������������������Ӄ_]jijmpw}�zvqjaWLB80*d��������������������������������������~^z|~���������þ�����n\L>3+?����������������������������������|e��������������������dz�zaN=1)>������������������������������c�����������������������ï
 ¿½Ð¶ï¿½rYE6,&c���������������������������u���������������������������ս�y^J9.'1�������������������������d�����������������������������ɯ�v]I9.'%�� [...]

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

Reply via email to