Opened 12 years ago
Closed 12 years ago
#10479 closed Patch - Bug Fix (fixed)
Possible loop/logic fault in ClassicCommDetector
Reported by: | Owned by: | beirdo | |
---|---|---|---|
Priority: | minor | Milestone: | 0.25 |
Component: | MythTV - Mythcommflag | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
clang detects a "ClassicCommDetector?.cpp:2232:28: warning: comparison of unsigned expression >= 0 is always true" warning in the code fragment:
for (uint64_t i = f; i >= 0; i--)
which could result in looping/faults.
There are various code styles to correct this, including:
for (uint64_t i = (f+1); i-- > 0; )
or
for (uint64_t i = f; i != (uint64_t) -1 ; i--)
I have provide a patch for the first.
Since this may impact the commercial detection results, the SME for commercial flagging should review the results of this patch with their test cases.
Thanks.
Gary
Attachments (1)
Change History (3)
Changed 12 years ago by
Attachment: | ClassicCommDetector_cpp_2.diff added |
---|
comment:1 Changed 12 years ago by
Component: | MythTV - General → MythTV - Mythcommflag |
---|---|
Milestone: | unknown → 0.25 |
Owner: | set to beirdo |
Status: | new → assigned |
Version: | Unspecified → Master Head |
comment:2 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
Keep an unsigned counter from going negative
Issue found by clang. This issue would likely be fairly rare, but it exists and should be fixed.
Fixes #10479.
Signed-off-by: Gavin Hurlbut <ghurlbut@…>