Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity: Possible ARRAY_VS_SINGLETON - Invalid Dereference #3286

Open
jmarrero opened this issue Aug 15, 2024 · 0 comments
Open

Coverity: Possible ARRAY_VS_SINGLETON - Invalid Dereference #3286

jmarrero opened this issue Aug 15, 2024 · 0 comments

Comments

@jmarrero
Copy link
Member

jmarrero commented Aug 15, 2024

Found during Coverity scan. ARRAY_VS_SINGLETON
@cgwalters looked at this during a meeting and it's not clear if it's a false positive or not, needs investigating.

1. Defect type: ARRAY_VS_SINGLETON
11. libostree-2024.7/src/libostree/ostree-repo-refs.c:651:15: address_of: Taking address with "&r" yields a singleton pointer.
12. libostree-2024.7/src/libostree/ostree-repo-refs.c:651:15: identity_transfer: Passing "&r" as argument 1 to function "g_steal_pointer", which returns that argument. [Note: The source code implementation of the function has been overridden by a user model.]
13. libostree-2024.7/src/libostree/ostree-repo-refs.c:651:15: assign: Assigning: "remote" = "(char *)g_steal_pointer(&r)".
35. libostree-2024.7/src/libostree/ostree-repo-refs.c:700:15: callee_ptr_arith: Passing "remote" to function "add_ref_to_set" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
#   698|                   return FALSE;
#   699|   
#   700|->               if (!add_ref_to_set (remote, NULL, prefix_dfd, ref_prefix, ret_all_refs, cancellable,
#   701|                                      error))
#   702|                   return FALSE;
2. Defect type: ARRAY_VS_SINGLETON
11. libostree-2024.7/src/libostree/ostree-repo-refs.c:651:15: address_of: Taking address with "&r" yields a singleton pointer.
12. libostree-2024.7/src/libostree/ostree-repo-refs.c:651:15: identity_transfer: Passing "&r" as argument 1 to function "g_steal_pointer", which returns that argument. [Note: The source code implementation of the function has been overridden by a user model.]
13. libostree-2024.7/src/libostree/ostree-repo-refs.c:651:15: assign: Assigning: "remote" = "(char *)g_steal_pointer(&r)".
38. libostree-2024.7/src/libostree/ostree-repo-refs.c:688:15: callee_ptr_arith: Passing "remote" to function "enumerate_refs_recurse" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
#   686|                   return FALSE;
#   687|   
#   688|->               if (!enumerate_refs_recurse (self, remote, flags, NULL, base_fd, base_path, base_fd,
#   689|                                              cut_prefix ? "." : ref_prefix, ret_all_refs, cancellable,
#   690|                                              error))

This code has not been touched in years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant