Opened 10 years ago

Closed 10 years ago

#10479 closed Patch - Bug Fix (fixed)

Possible loop/logic fault in ClassicCommDetector

Reported by: Gary Buhrmaster <gary.buhrmaster@…> Owned by: beirdo
Priority: minor Milestone: 0.25
Component: MythTV - Mythcommflag Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no


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; )


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.



Attachments (1)

ClassicCommDetector_cpp_2.diff (489 bytes) - added by Gary Buhrmaster <gary.buhrmaster@…> 10 years ago.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by Gary Buhrmaster <gary.buhrmaster@…>

comment:1 Changed 10 years ago by stuartm

Component: MythTV - GeneralMythTV - Mythcommflag
Milestone: unknown0.25
Owner: set to beirdo
Status: newassigned
Version: UnspecifiedMaster Head

comment:2 Changed 10 years ago by Github

Resolution: fixed
Status: assignedclosed

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@…>

Branch: master Changeset: 414159df9ea07cdf64ea36ca920f5d35242fd38a

Note: See TracTickets for help on using tickets.