json icon indicating copy to clipboard operation
json copied to clipboard

json stream: Fix out-of-bound memory access by using *start+size instead of *end

Open enrico-samknows opened this issue 2 years ago • 7 comments

Fix out-of-bound memory access by using start+size instead of a pointer to the first byte after buffer end.

By using clang AddressSanitizer, I got memory access errors when calling serialize() because the end_ pointer refers to a memory byte that is not owned by anyone (it's actually the first byte after the buffer). This PR fixes the error for me by using start_ and size_ to track the buffer boundaries.

enrico-samknows avatar Dec 31 '21 13:12 enrico-samknows

Why doesn't our asan target in CI report this?

vinniefalco avatar Dec 31 '21 14:12 vinniefalco

I used ASAN_OPTIONS=detect_invalid_pointer_pairs=2. Is yours set to 0?

enrico-samknows avatar Dec 31 '21 14:12 enrico-samknows

I used ASAN_OPTIONS=detect_invalid_pointer_pairs=2. Is yours set to 0?

Good question :) If it isn't set to 2 then we should set it to 2. @sdarwin ?

vinniefalco avatar Jan 01 '22 06:01 vinniefalco

Hello, any update on this? Is it worthwhile to you or should I close it?

enrico-samknows avatar Feb 01 '22 10:02 enrico-samknows

Nope don't close this

vinniefalco avatar Feb 01 '22 15:02 vinniefalco

I fixed all asan failures I've managed to reproduce locally with the options you mentioned. Can you test current develop branch if your failures are reproducible still?

grisumbras avatar Jun 08 '23 13:06 grisumbras

I fixed all asan failures I've managed to reproduce locally with the options you mentioned. Can you test current develop branch if your failures are reproducible still?

hello, will I get your changes if I try Boost "Version 1.83.0 beta 1"?

enrico-samknows avatar Jul 31 '23 08:07 enrico-samknows

hello, will I get your changes if I try Boost "Version 1.83.0 beta 1"?

Yes.

grisumbras avatar Jul 31 '23 13:07 grisumbras

I'm closing this for now. If the problem still occurs, please reopen.

grisumbras avatar Sep 29 '23 09:09 grisumbras