electronicarts / EASTL

EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.
BSD 3-Clause "New" or "Revised" License
8.09k stars 929 forks source link

Fix fixed_string resize within SSO capacity #495

Closed W4RH4WK closed 9 months ago

W4RH4WK commented 1 year ago

As pointed out in #454, when fixed_string gets resized but capacity stays within SSO capacity the null-terminator gets copied over as well. The corresponding code assumes heap capacity is always greater than SSO capacity. fixed_string's internal buffer is handled as heap inside the string class and may, in fact, be <= SSO capacity.

This commit fixes the described issue and adds a unit test for this specific case.

grojo-ea commented 1 year ago

Hello,

Thanks for looking at this issue and for the PR. I'm going to have to think a bit about this to see if this is the way we want to fix the issue.

In the meantime, I've noticed we don't have a CLA from you yet, could you please go here and fill out the form? We'll need it if we decide this is the way to go to solve the issue.