This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 7b0e1d7cec lavc/hashtable: fix occupancy tracking across delete/clears
There is a bug where `ff_hashtable_delete` does not decrement a hashtable's
occupancy when no elements following a deleted entry need to be moved. There is
also a bug where `ff_hashtable_clear` does not reset the occupancy to zero,
This change fixes both issues.
7b0e1d7cec is described below
commit 7b0e1d7ceca73e55dbbba925574d1a0938a3d910
Author: Emma Worley <[email protected]>
AuthorDate: Fri Sep 18 00:28:24 2026 -0700
Commit: Emma Worley <[email protected]>
CommitDate: Thu Sep 24 12:33:16 2026 -0700
lavc/hashtable: fix occupancy tracking across delete/clears
There is a bug where `ff_hashtable_delete` does not decrement a hashtable's
occupancy when no elements following a deleted entry need to be moved.
There is
also a bug where `ff_hashtable_clear` does not reset the occupancy to zero,
This
change fixes both issues.
Signed-off-by: Emma Worley <[email protected]>
---
libavcodec/hashtable.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hashtable.c b/libavcodec/hashtable.c
index d18e872f4f..a49c488e40 100644
--- a/libavcodec/hashtable.c
+++ b/libavcodec/hashtable.c
@@ -184,15 +184,15 @@ int ff_hashtable_delete(struct FFHashtableContext *ctx,
const void *key)
if (++wrapped_index == ctx->max_entries)
wrapped_index = 0;
next_entry = ctx->table + wrapped_index * ctx->entry_size;
- if (ENTRY_PSL_VAL(next_entry) <= 1) {
- ctx->nb_entries--;
- return 1;
- }
+ if (ENTRY_PSL_VAL(next_entry) <= 1)
+ break;
memcpy(entry, next_entry, ctx->entry_size);
ENTRY_PSL_VAL(entry)--;
ENTRY_PSL_VAL(next_entry) = 0;
entry = next_entry;
}
+ ctx->nb_entries--;
+ return 1;
}
}
return 0;
@@ -201,6 +201,7 @@ int ff_hashtable_delete(struct FFHashtableContext *ctx,
const void *key)
void ff_hashtable_clear(struct FFHashtableContext *ctx)
{
memset(ctx->table, 0, ctx->entry_size * ctx->max_entries);
+ ctx->nb_entries = 0;
}
av_cold void ff_hashtable_freep(FFHashtableContext **ctx)
--
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]