Page MenuHomePhorge

Add Room::localEcho and related test
ClosedPublic

Authored by nannanko on Aug 2 2024, 10:58 PM.

Details

Summary

This adds a function in Room to get a local echo in the room by its txn id.

Type: add

Test Plan

Verify tests pass.

Diff Detail

Repository
rL libkazv
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Please add a changelog type to the summary, using the following format:

Type: (add|remove|skip|security|fix)

tusooa requested changes to this revision.Aug 3 2024, 6:40 PM

add a test to verify it does not crash when the txn id is not found.

src/client/room/room.cpp
109

you must handle the case where find_if returns localEchoes.end(), which is an invalid iterator.

this MAY WELL happen if, in the process of cancelling, the message has already been sent.

your current implementation will cause undefined behaviour due to dereferencing the past-the-end iterator, which is invalid.

This revision now requires changes to proceed.Aug 3 2024, 6:40 PM

Handle the case where find_if returns localEchoes.end(), and update related test

This revision is now accepted and ready to land.Aug 6 2024, 6:17 PM