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

git pushed a commit to branch devs/devilhorns/apos
in repository efl.

View the commit online.

commit b632c3ef1158126b911bbdba3ac90384bc837a78
Author: Carsten Haitzler <ras...@rasterman.com>
AuthorDate: Tue Dec 19 11:02:29 2023 +0000

    eet - fix write denied - no seg on dict free + check on open
    
    @fix
---
 src/lib/eet/eet_dictionary.c | 9 ++++++---
 src/lib/eet/eet_lib.c        | 9 ++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/lib/eet/eet_dictionary.c b/src/lib/eet/eet_dictionary.c
index 4413a6d690..5b5cec2868 100644
--- a/src/lib/eet/eet_dictionary.c
+++ b/src/lib/eet/eet_dictionary.c
@@ -31,11 +31,14 @@ eet_dictionary_free(Eet_Dictionary *ed)
    if (!ed) return;
    eina_rwlock_free(&ed->rwlock);
 
-   for (i = 0; i < ed->count; i++)
+   if ((ed->all_allocated) && (ed->all))
      {
-        if (ed->all_allocated[i >> 3] & (1 << (i & 0x7)))
+        for (i = 0; i < ed->count; i++)
           {
-             eina_stringshare_del(ed->all[i].str);
+             if (ed->all_allocated[i >> 3] & (1 << (i & 0x7)))
+               {
+                  eina_stringshare_del(ed->all[i].str);
+               }
           }
      }
    free(ed->all);
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index 3a1e885443..59b4e49201 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -1527,7 +1527,7 @@ eet_open(const char   *file,
 {
    Eina_File *fp;
    Eet_File *ef;
-   int file_len;
+   int file_len, ret;
    unsigned long int size;
 
    if (!file)
@@ -1566,6 +1566,11 @@ eet_open(const char   *file,
    /* try open the file based on mode */
    if ((mode == EET_FILE_MODE_READ) || (mode == EET_FILE_MODE_READ_WRITE))
      {
+        if (mode == EET_FILE_MODE_READ_WRITE)
+          {
+             ret = access(file, W_OK);
+             if ((ret != 0) && (errno != ENOENT)) return NULL;
+          }
         /* Prevent garbage in futur comparison. */
          fp = eina_file_open(file, EINA_FALSE);
          if (!fp)
@@ -1601,6 +1606,8 @@ open_error:
         size = 0;
 
         fp = NULL;
+        ret = access(file, W_OK);
+        if ((ret != 0) && (errno != ENOENT)) return NULL;
      }
 
    /* We found one */

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

Reply via email to