-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
etl::unordered_map buffer overflow #803
Comments
I've made a change to the
At least I have somehow verified my speculation from the above issue |
I don't think that would work as the map with the larger number of buckets would not have all of its buckets tested. |
What I think is required is an |
I've a basic question on how a comparison on a ETL container should work. A simple example might be:
Will they compare equal? Yes, they do: https://gcc.godbolt.org/z/Gd6o4xx6q (For etl::vector and etl::ivector types) I would expect the same behavior with an ETL unordered_map. For example:
I would expect them to compare equal, but they don't: https://gcc.godbolt.org/z/hdffTrxxz Getting back to the general question on how containers with different capacity should compare in ETL, I think that they should compare equal if the size and content is the same. This is the case (for example) for If we agree on the defined behavior I can think of a solution for |
I've tried a new version for I also noticed that the template parameters were incorrect for
|
Whatever the intended behavior is, it should be the same with all container types, shouldn't it? Correct. |
Operator == patch |
I applied your patch to my repository and it seems to work. All my unittest are passed now :-) Will you merge it? |
I need to run my full CI tests on my machine first, and if everything is ok, I'll merge and push a new version. |
The basic idea of the
i...
base classes (AFAIK) is that you can use them on interfaces without knowing the size of a container.This example uses 2 empty
etl::unordered_map
's of different sizes and compares them via base class references (see Godbolt at the end):This seems to be a valid use of the
i...
base classes. And it worked in version 20.28.0 for me. I tried to switch to version 20.38.10 but it fails in my unit tests (I have additional ones added independent of the ETL unit tests) because I'm using the address sanitizer while developing. BTW, it also fails if you compareunordered_map
's instead ofiunordered_map
's because they seem to use the sameoperator==
.There seems to be a change in the
operator==
for theunordered_map
. Bevor it just usedetl::equal
and currently it somehow seems to iterate over the bucket size which is different for the above containers (and therefor "overflows" the second smaller container).Sadly the buffer overflow is only visible with additional tooling (
-fsanitize=address
) and looks like it's working without (but it's not).This Godbolt example - with the currently latest version of ETL - will produce the problem: https://gcc.godbolt.org/z/qnn1e8TeY
The text was updated successfully, but these errors were encountered: