nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.29k stars 325 forks source link

Fixes an error in memory copying when increasing the size of nxt_vector_t #963

Closed nikolay-govorov closed 10 months ago

nikolay-govorov commented 10 months ago

Thanks for the work you are doing. Unit is a really great tool.

I found that when system increase the size if nxt_ vector_t, the function copy more bytes into the new buffer from the old buffer than there are (the new size, not the old). This usually doesn't result in an apparent error since there is something in the allocator buffer, but occasionally it can end in a segfault.

The address-sanitizer will also not tell you this because of its own allocator. You could potentially markup your allocator to see such errors in tests.

hongzhidao commented 10 months ago

Hi, Thanks for reporting it, but this file is not used. You could take a look at nxt_array.h/c instead which does the same thing. We don't maintain these unused files and we might consider deleting them in the future.

nikolay-govorov commented 10 months ago

Oh yes indeed, nxt_array works great and did not inherit this problem. Thank you.