Skip to content

rts/eventlog: Fix a variety of issues

Ben Gamari requested to merge wip/T24197 into master

In #24197 (closed) we found that dumpIPEToEventLog could fairly easily crash the runtime due to a constellation of bugs:

  • ensureRoomForVariableEvent truncated the event size to 16-bits (yet IPE events routinely exceed 2^16 bytes)
  • postIPE failed to respect ensureRoomForVariableEvent failing
  • postString failed to account for the NUL terminator byte in its own local assertion

Here we fix the above, resolving the proximate cause of #24197 (closed). In addition, we mark a few important functions with the warn_unused_result attribute to ensure that their results are respected.

We do not fix the problem of IPE events being of unbounded size. However, I expect that >2MB events are likely rare enough that they shouldn't occur in real codebases (and if/when they do occur we should now fail with an somewhat reasonable error message). I do hesitate to say "never" though as type family reduction can easily result in very large types.

Fixes #24197 (closed).

Edited by Ben Gamari

Merge request reports