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

git pushed a commit to reference refs/pull/122/head
in repository efl.

View the commit online.

commit 761371f5fbb511c0b0c5468e2af6098afd8fccbf
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Nov 26 14:00:28 2026 -0600

    edje_cc: do not crash on a vector image without an images block
    
    A VECTOR description naming a vector file in image.normal made
    edje_cc look the name up in image_dir, which only exists once an
    images {} block declared something. Without one, edje_cc segfaulted
    instead of reporting the undeclared vector resource.
    
    The test runs edje_cc on such an edc through a small wrapper that
    wants a non-zero exit and the error message: meson's should_fail
    would also accept the crash.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/bin/edje/edje_cc_handlers.c                     |  2 +-
 src/tests/edje/data/test_error_vector_no_images.edc | 11 +++++++++++
 src/tests/edje/edje_cc_expect_error.sh              | 17 +++++++++++++++++
 src/tests/edje/meson.build                          | 13 +++++++++++++
 4 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 09202e6bf4..88bbc72f72 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -2327,7 +2327,7 @@ _handle_vector_image(void)
 
    ed->vg.id = -1;
 
-   for (i = 0; i < edje_file->image_dir->vectors_count; ++i)
+   for (i = 0; edje_file->image_dir && (i < edje_file->image_dir->vectors_count); ++i)
      {
         if (!strcmp(edje_file->image_dir->vectors[i].entry, name))
           {
diff --git a/src/tests/edje/data/test_error_vector_no_images.edc b/src/tests/edje/data/test_error_vector_no_images.edc
new file mode 100644
index 0000000000..eafe1a65da
--- /dev/null
+++ b/src/tests/edje/data/test_error_vector_no_images.edc
@@ -0,0 +1,11 @@
+collections {
+   group { name: "g";
+      parts {
+         part { name: "v"; type: VECTOR;
+            description { state: "default" 0.0;
+               image.normal: "x.json";
+            }
+         }
+      }
+   }
+}
diff --git a/src/tests/edje/edje_cc_expect_error.sh b/src/tests/edje/edje_cc_expect_error.sh
new file mode 100755
index 0000000000..01f51b8af9
--- /dev/null
+++ b/src/tests/edje/edje_cc_expect_error.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# usage: edje_cc_expect_error.sh <message> <edje_cc command...> <edc> <edj>
+# Passes only when edje_cc exits with an error and prints <message>, so a
+# crash does not count as an expected failure.
+
+message="$1"
+shift
+
+output=$("$@" 2>&1)
+status=$?
+echo "$output"
+
+[ "$status" -ne 0 ] || exit 1
+case "$output" in
+   *"$message"*) exit 0 ;;
+esac
+exit 1
diff --git a/src/tests/edje/meson.build b/src/tests/edje/meson.build
index 3f9a70e3b1..833b93ffbe 100644
--- a/src/tests/edje/meson.build
+++ b/src/tests/edje/meson.build
@@ -28,3 +28,16 @@ test('edje-suite', edje_suite,
   env : test_env,
   timeout : master_timeout
 )
+
+sh = find_program('sh', required : false)
+
+if sh.found()
+  test('edje-cc-vector-image-without-images-block', sh,
+    args : [files('edje_cc_expect_error.sh'), 'Failed to find the vector resource',
+            edje_cc, files('data/test_error_vector_no_images.edc'),
+            join_paths(meson.current_build_dir(), 'test_error_vector_no_images.edj')],
+    env : test_env,
+    depends : edje_depends,
+    timeout : master_timeout
+  )
+endif

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

Reply via email to