Project

General

Profile

Actions

Bug #7828

open

Unexpected remove behavior in util-hash

Added by Charles Vigue 9 days ago. Updated 8 days ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

In util-hash.c I have observed some behavior that is unexpected and likely incorrect. To see this behavior, create a hash table 32 entries wide and use the default hash function. Then add a short string “abc”, observe the string is stored properly. Now remove a string “iln”, and observe string “abc” is no longer in the table.

Other scenarios can provoke this behavior but this is possibly the simplest way. It occurs because if the table slot has one entry, remove does not perform a compare before removal.

I have a unit test patch to show this, and a fix patch to make it behave as a typical hash table would behave. The behavior goes back to at least 6.0 and continues into the current 8.0.1 work branch.

I am working on a PR now.


Related issues 1 (0 open1 closed)

Has duplicate Suricata - Bug #7475: Problem in HashTable remove functionRejectedActions
Actions #1

Updated by Philippe Antoine 9 days ago

  • Related to Bug #7475: Problem in HashTable remove function added
Actions #2

Updated by Philippe Antoine 9 days ago

  • Affected Versions 8.0.0 added
Actions #4

Updated by Juliana Fajardini Reichow 8 days ago

  • Assignee changed from OISF Dev to Charles Vigue

Assigning to the author as there's already a PR :)

Actions #6

Updated by Shivani Bhardwaj 8 days ago

  • Related to deleted (Bug #7475: Problem in HashTable remove function)
Actions #7

Updated by Shivani Bhardwaj 8 days ago

  • Has duplicate Bug #7475: Problem in HashTable remove function added
Actions

Also available in: Atom PDF