[Git][ghc/ghc][master] eventlog: Fix off-by-one error in postIPE

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jan 16 20:41:18 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
5776008c by Matthew Pickering at 2024-01-16T15:40:42-05:00
eventlog: Fix off-by-one error in postIPE

We were missing the extra_comma from the calculation of the size of the
payload of postIPE. This was causing assertion failures when the event
would overflow the buffer by one byte, as ensureRoomForVariable event
would report there was enough space for `n` bytes but then we would
write `n + 1` bytes into the buffer.

Fixes #24287

- - - - -


1 changed file:

- rts/eventlog/EventLog.c


Changes:

=====================================
rts/eventlog/EventLog.c
=====================================
@@ -1438,7 +1438,8 @@ void postIPE(const InfoProvEnt *ipe)
     // 8 for the info word
     // 1 null after each string
     // 1 colon between src_file and src_span
-    StgWord len = 8+table_name_len+1+closure_desc_len+1+ty_desc_len+1+label_len+1+module_len+1+src_file_len+1+src_span_len+1;
+    StgWord extra_comma = 1;
+    StgWord len = 8+table_name_len+1+closure_desc_len+1+ty_desc_len+1+label_len+1+module_len+1+src_file_len+1+extra_comma+src_span_len+1;
     CHECK(!ensureRoomForVariableEvent(&eventBuf, len));
     postEventHeader(&eventBuf, EVENT_IPE);
     postPayloadSize(&eventBuf, len);



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5776008c7a5581193c3e72e59451ad49abac9d81

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5776008c7a5581193c3e72e59451ad49abac9d81
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240116/8b7dc3d2/attachment.html>


More information about the ghc-commits mailing list