Opened 7 years ago
Closed 7 years ago
Last modified 7 years ago
#13531 closed Patch - Bug Fix (fixed)
Fix for Coverity 1456162 and 1456180
| Reported by: | Gary Buhrmaster | Owned by: | David Hampton |
|---|---|---|---|
| Priority: | minor | Milestone: | 31.0 |
| Component: | MythTV - General | Version: | Master Head |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
Low hanging fruit from Coverity scan.
Sizeof returns size of the array (24 for a 3 array double on some architectures) and not the number of elements.
Compile tested only.
diff --git a/mythtv/libs/libmythui/DisplayResScreen.cpp b/mythtv/libs/libmythui/DisplayResScreen.cpp
index 44ffc8c015..a94fd319c5 100644
--- a/mythtv/libs/libmythui/DisplayResScreen.cpp
+++ b/mythtv/libs/libmythui/DisplayResScreen.cpp
@@ -140,7 +140,7 @@ int DisplayResScreen::FindBestMatch(const DisplayResVector& dsr,
while (!end)
{
double precisions1[] = {0.001, 0.01, 0.1};
- for (uint p = 0; p < sizeof(precisions1); p++)
+ for (uint p = 0; p < (sizeof(precisions1)/sizeof(precisions1[0])); p++)
{
double precision = precisions1[p];
for (size_t j=0; j < rates.size(); ++j)
@@ -159,7 +159,7 @@ int DisplayResScreen::FindBestMatch(const DisplayResVector& dsr,
// Can't find exact frame rate, so try rounding to the
// nearest integer, so 23.97Hz will work with 24Hz etc
double precisions2[] = {0.01, 0.1, 1};
- for (uint p = 0; p < sizeof(precisions2); p++)
+ for (uint p = 0; p < (sizeof(precisions2)/sizeof(precisions2[0])); p++)
{
double precision = precisions2[p];
double rounded = round(videorate);
Change History (5)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:3 by , 7 years ago
| Milestone: | needs_triage → 31.0 |
|---|
comment:5 by , 7 years ago
This 'fix' may be more syntactically correct but I'm still losing a/v sync in continuous playback on a no-nVidia ffmpeg-decode box. The logs do not reflect this. May be time for a new ticket.
Note:
See TracTickets
for help on using tickets.

This looks a likely cure for my recent a/v sync issue. Patching in my build system has been awkward and error prone. I'm sure git does it better but I haven't yet found how...