[Kde-games-devel] Review Request: Avoid a crash when knavalbattle receives a valid (but understood) xml message

Albert Astals Cid tsdgeos at terra.es
Sun Dec 9 18:42:45 UTC 2012



> On Dec. 8, 2012, 3:30 p.m., Albert Astals Cid wrote:
> > Ship It!
> 
> Albert Astals Cid wrote:
>     Actually maybe it would make more sense not emmiting a null message from the protocol.cpp file instead of protecting from a null message in the networkentity.cpp slot? Anyway any of the two solutions work, commit the one you prefer :-)
> 
> Jaime Torres Amate wrote:
>     In protocol.cpp, this is the "offending" message: return MessagePtr(); (after emit parseError("Unknown message type"); ).
>     I think it is easier to detect a NULL in networkentity.cpp than to create an special MessagePtr to handle this...

I actually meant

changing
        MessagePtr msg = parseMessage(m_buffer.left(pos));
        m_buffer.remove(0, pos);

        emit received(msg);


to
        MessagePtr msg = parseMessage(m_buffer.left(pos));
        m_buffer.remove(0, pos);

        if (msg)
            emit received(msg);


- Albert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107554/#review23156
-----------------------------------------------------------


On Dec. 2, 2012, 9:51 a.m., Jaime Torres Amate wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107554/
> -----------------------------------------------------------
> 
> (Updated Dec. 2, 2012, 9:51 a.m.)
> 
> 
> Review request for KDE Games.
> 
> 
> Description
> -------
> 
> Avoid a crash when knavalbattle receives a valid (but understood) xml message.
> When the not understood message (for example, the one needed to enable/disable adjacent ships, for KDE SC 4.11) is received, msg is null.
> 
> 
> Diffs
> -----
> 
>   src/networkentity.cpp 3367389 
> 
> Diff: http://git.reviewboard.kde.org/r/107554/diff/
> 
> 
> Testing
> -------
> 
> Does not crash, even when does not receives a non valid xml message.
> 
> 
> Thanks,
> 
> Jaime Torres Amate
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20121209/caa4474f/attachment.html>


More information about the kde-games-devel mailing list