ligzy / tstools

Automatically exported from code.google.com/p/tstools
0 stars 0 forks source link

Check for last_cc incorrectly excludes last CC being zero #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

In tsreport.c I believe there's a error in the check as per the diff below. The 
check is for ss->last_cc being set (i.e. there has been a previous CC). last_cc 
is set to -1 to indicate no previous CC, so the check must be for last_cc >= 0 
(or >-1, or != -1). Otherwise a valid previous CC of zero will read as there 
having been no previous CC, potentially missing an error. 

diff --git a/tsreport.c b/tsreport.c
index c7885bc..29d20d1 100644
--- a/tsreport.c
+++ b/tsreport.c
@@ -496,7 +496,7 @@ static int report_buffering_stats(TS_reader_p  tsreader,
       // CC is meant to increment if we have a payload and not if we don't
       // CC may legitimately 'be wrong' if the discontinuity flag is set

-      if (ss->last_cc > 0 && !is_discontinuity)
+      if (ss->last_cc >= 0 && !is_discontinuity)
       {
         // We are allowed 1 dup packet
         if (ss->last_cc == cc)

Original issue reported on code.google.com by piers.sc...@ericsson.com on 29 Jul 2013 at 10:39

GoogleCodeExporter commented 9 years ago
Exported project and fixed this at: https://github.com/PiersEBMS/tstools 

Original comment by piers.sc...@ericsson.com on 11 Apr 2015 at 1:44