This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit 57f30a3faa136bb959008224a83debc832b0295e
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Nov 9 00:56:58 2026 -0600
ecore: a composite slice whose count wraps around is refused
Efl.Ui.Collection_View can ask for a slice with a count that wraps
start + count around (seen while a row is removed during a scroll:
_batch_request_flush from child,removed). The bounds check compares the
wrapped sum, so it passed; the source refused it later. Since a pending
slice keeps where each of its rows is, the request is sized by count,
and such a count asked for 16 GB: the process was killed for memory.
Refuse it up front with EFL_MODEL_ERROR_INCORRECT_VALUE, as the source
did. (The view asking for it is a separate bug.)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/ecore/efl_composite_model.c | 7 +++++++
src/tests/efl/efl_test_composite_model.c | 36 ++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c
index b7ac770c7d..49975dd397 100644
--- a/src/lib/ecore/efl_composite_model.c
+++ b/src/lib/ecore/efl_composite_model.c
@@ -2,6 +2,8 @@
# include <config.h>
#endif
+#include <limits.h>
+
#include <Eina.h>
#include <Efl.h>
#include <Ecore.h>
@@ -507,6 +509,11 @@ _efl_composite_model_efl_model_children_slice_get(Eo *obj,
unsigned int source_count, self_count;
unsigned int req_count, i;
+ // A count that wraps start + count around asks for nothing that exists (it would pass the
+ // check below, and size what the answer is waited for with)
+ if (count > UINT_MAX - start)
+ return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
+
source_count = efl_model_children_count_get(pd->source);
self_count = efl_model_children_count_get(obj);
diff --git a/src/tests/efl/efl_test_composite_model.c b/src/tests/efl/efl_test_composite_model.c
index 13e84ccb83..12eca1fcdc 100644
--- a/src/tests/efl/efl_test_composite_model.c
+++ b/src/tests/efl/efl_test_composite_model.c
@@ -20,6 +20,8 @@
# include "config.h"
#endif
+#include <limits.h>
+
#include "efl_suite.h"
#include <Efl.h>
@@ -1190,6 +1192,39 @@ EFL_START_TEST(efl_test_composite_model_pending_slice_removed_row)
}
EFL_END_TEST
+// A slice whose count wraps start + count around asks for nothing that exists.
+static Eina_Value
+_wrap_error(void *data, const Eina_Value v, const Eina_Future *dead EINA_UNUSED)
+{
+ Eina_Error *err = data;
+
+ if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ERROR)
+ eina_value_error_get(&v, err);
+ else
+ *err = 0;
+ return v;
+}
+
+EFL_START_TEST(efl_test_composite_model_slice_count_wraps)
+{
+ Eina_Error err = -1;
+ Eo *base, *model, *rows[6];
+ unsigned int i;
+
+ model = _pending_setup(&base, rows, 6);
+ eina_future_then(efl_model_children_slice_get(model, 10, UINT_MAX - 5),
+ _wrap_error, &err, NULL);
+ for (i = 0; (i < 8) && (err == -1); i++)
+ {
+ ecore_main_loop_iterate();
+ }
+ ck_assert_int_eq(err, EFL_MODEL_ERROR_INCORRECT_VALUE);
+
+ efl_unref(model);
+ efl_unref(base);
+}
+EFL_END_TEST
+
void
efl_test_case_boolean_model(TCase *tc)
{
@@ -1205,4 +1240,5 @@ efl_test_case_boolean_model(TCase *tc)
tcase_add_test(tc, efl_test_composite_model_pending_slice_insert);
tcase_add_test(tc, efl_test_composite_model_pending_slice_remove);
tcase_add_test(tc, efl_test_composite_model_pending_slice_removed_row);
+ tcase_add_test(tc, efl_test_composite_model_slice_count_wraps);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.