Browse Source

Fix decoding of descriptor 0x58

Georgi Chorbadzhiyski 8 years ago
parent
commit
d5d0171a7d
1 changed files with 8 additions and 3 deletions
  1. 8 3
      descs.c

+ 8 - 3
descs.c View File

@@ -382,7 +382,11 @@ void ts_descriptor_dump(uint8_t *desc_data, int desc_data_len) {
382 382
 			}
383 383
 			case 0x58: { // local_timeoffset
384 384
 				ts_LOGf("%sTag 0x%02x (%02d), sz: %d, Local timeoffset descriptor\n", pad, tag, tag, this_length);
385
-				if (this_length == 13) {
385
+				if (this_length % 13 != 0) {
386
+					ts_LOGf("%s  !!! length %% 13 != 0 (%d)\n", pad, this_length);
387
+					break;
388
+				}
389
+				while (this_length > 0) {
386 390
 					uint16_t mjd, lto, lto_next;
387 391
 					uint32_t bcd;
388 392
 					time_t ts;
@@ -411,8 +415,9 @@ void ts_descriptor_dump(uint8_t *desc_data, int desc_data_len) {
411 415
 						tm.tm_hour, tm.tm_min, tm.tm_sec,
412 416
 						mjd, bcd, ts);
413 417
 					ts_LOGf("%s  LTO next    : %c%04x\n", pad, polarity ? '-' : '+', lto_next);
414
-				} else {
415
-					ts_LOGf("%s  !!! length != 13 (%d)\n", pad, this_length);
418
+					data += 13;
419
+					data_len -= this_length;
420
+					this_length -= 13;
416 421
 				}
417 422
 				break;
418 423
 			}