Opened 14 years ago

Closed 14 years ago

#2278 closed patch (fixed)

Prevent overstepping list boundaries in ParseGeometryOverride

Reported by: sphery <mtdean@…> Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version:
Severity: medium Keywords:
Cc: Ticket locked: no

Description

In the event that a user specifies the -geometry or --geometry option to mythfrontend or mythtv-setup using the WxH format (not the WxH+X+Y format), MythContext::ParseGeometryOverride?() oversteps the boundaries of the QStringList geo. The results of such behavior is undefined by QT, but generally seems to just log a warning:

ASSERT: "i <= nodes" in /usr/qt/include/qvaluelist.h (372)

in the mythfrontend/mythtv-setup logs and m_geometry_x and m_geometry_y either remain at their defaults or are set to 0 due to a failed parsing (not sure which way it happens, but the values end up being 0).

The attached patch fixes ParseGeometryOverride?() to check whether the width and height were specified before attempting to parse them. As before the patch, ParseGeometryOverride?() continues to use the same default values for X and Y location (0,0), not the values specified for GuiOffsetX and GuiOffsetY in the database. If you feel it makes more sense to use the GUI settings, instead, please let me know.

The section of code which oversteps the boundaries is not critical (because of the defaults/resolving to 0, which happens to be a good default). So, for all practical purposes, it's simply checking to verify that the values can be parsed as ints so it can log messages in the event of failure. However, due to the regex's that verify the format, I can't see a way the error messages could be triggered (as we'll return with an error if the format is wrong), so there were never any bug reports issued about this behavior. I fixed it mainly to get rid of the annoying warning.

Attachments (1)

mythtv-ParseGeometryOverride-list_boundary.patch (1.2 KB) - added by sphery <mtdean@…> 14 years ago.

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by sphery <mtdean@…>

comment:1 Changed 14 years ago by Isaac Richards

Resolution: fixed
Status: newclosed

(In [11053]) Minor logic error fix when parsing command line geometry options.

Closes #2278.

Note: See TracTickets for help on using tickets.