ITADN

_zip_hash_add() returns false after successful insert when hash_resize() fails

#508ClosedMicroMilo 创建于 2025-10-22
M
MicroMilocommented
While reviewing the implementation of `_zip_hash_add()` in `zip_hash.c`, I noticed a potential logical inconsistency in the function’s return semantics. When a new hash entry is successfully inserted, but a subsequent call to `hash_resize()` fails (e.g., due to memory pressure), the function returns false, even though the insertion itself has already succeeded. This results in a confusing state where: - The hash table contains the newly inserted entry, but the function reports failure to the caller. - This can lead to inconsistent behavior or “false failure” handling at higher layers. https://github.com/nih-at/libzip/blob/e16526dbb751dc31129b32ba667ce6aed5c42f97/lib/zip_hash.c#L236-L248
关闭于 2025-10-22 1 条评论