Opened 13 years ago

Closed 13 years ago

#4742 closed defect (invalid)

dyncast can return zero. Resulting pointer should be checked in mythui

Reported by: Erik Hovland <erik@…> Owned by: stuartm
Priority: trivial Milestone: 0.21
Component: mythtv Version: head
Severity: low Keywords:
Cc: Ticket locked: no


Unfortunately dynamic_cast<>() can return zero if the cast fails. In mythui the member function MythMainWindow::eventFilter receives an event from the QT event system and dynamic_cast<>() it to the key event that MythTV needs. It is highly unlikely that this event will not be a key event. But if it weren't then the dyncast would fail and give a null pointer. Meaning that in a few more lines when the pointer is dereferenced, down the drain we would go.

Attachments (1)

check-dyncast-in-mythmainwindow.patch (957 bytes) - added by Erik Hovland <erik@…> 13 years ago.
Checks dyncast for null in mythui

Download all attachments as: .zip

Change History (3)

comment:1 Changed 13 years ago by stuartm

Owner: changed from Isaac Richards to stuartm
Status: newassigned

Changed 13 years ago by Erik Hovland <erik@…>

Checks dyncast for null in mythui

comment:2 Changed 13 years ago by Isaac Richards

Resolution: invalid
Status: assignedclosed

That's the point of having the type enum in QEvent.

Note: See TracTickets for help on using tickets.