On IRC, bobnomnom notes a similar issue with channel_tls_process_certs_cells. In this case, the compiler can't easily optimize the pointer comparison away, so we don't need to worry about that, but technically speaking we might be constructing a pointer that wraps around ((void*)-1), which would give incorrect results.
And undefined behavior is very bad. So let's just fix this. Let's hunt for other places it occurs too.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
Trac: Description: See #101313 for general discription.
On IRC, bobnomnom notes a similar issue with channel_tls_process_certs_cells. In this case, the compiler can't easily optimize the pointer comparison away, so we don't need to worry about that, but technically speaking we might be constructing a pointer that wraps around ((void*)-1), which would give incorrect results.
And undefined behavior is very bad. So let's just fix this. Let's hunt for other places it occurs too.
On IRC, bobnomnom notes a similar issue with channel_tls_process_certs_cells. In this case, the compiler can't easily optimize the pointer comparison away, so we don't need to worry about that, but technically speaking we might be constructing a pointer that wraps around ((void*)-1), which would give incorrect results.
And undefined behavior is very bad. So let's just fix this. Let's hunt for other places it occurs too.
Patch in branch "bug10363_024" in my public repository. Needs review; this is getting a bit ugly. Can anybody suggest a better pattern? Let's also hunt for more instances.
I found two more instances and added fixes for them in "bug10363_024". This still needs careful review. The eventdns.c changes should get pushed upstream to libevent.
e8b7224d88c8bf96ef58de444315304edefe66e1 looks fine to me
47d604fa8ffe5a62c78f766d95045c4eb224889a looks fine to me
In 66931507cf8f5e782469c90d0db2858d9af58c14, is the 'if (cp >= end)' test on line 853 also possibly an issue? It's the only remaining use of 'end' after the current patch I believe.
83763622c589af82db3cc67d08097f60ac98c8a3 yeah, I like this better than the one after 47d604fa8ffe5a62c78f766d95045c4eb224889a
e40a8796990b5f01c0504c3bb0e1d702eb68f9f1 seems much less icky than the old one, at least going by the amounts of time it took my presently rather frayed-at-the-edges brain to conclude that both have the same behavior and do not attempt to read past the end of the array if cell->payload_len is odd.
99cda334a910f8e24c7e0da58a522dae103f9163 looks fine to me
I'd be inclined to skip this one -- it's quite a bit of code changes, and as you say it's only likely to matter if we get a nasty allocator, and also 0.2.5.x will be out real soon now right?