summaryrefslogtreecommitdiff
path: root/wiretap/mp2t.c
diff options
context:
space:
mode:
authorDominic Chen <d.c.ddcc@gmail.com>2016-04-25 18:12:00 -0400
committerAnders Broman <a.broman58@gmail.com>2016-04-27 07:43:53 +0000
commitf90882fa2fac5d81aacc99e7f7fc5eb57409d093 (patch)
tree3486f1ac6db032659dfa61a1dde69cf97b333c43 /wiretap/mp2t.c
parente899c3eb610b4f546dfced6c41ae4e166b9c729e (diff)
downloadwireshark-f90882fa2fac5d81aacc99e7f7fc5eb57409d093.tar.gz
mp2t: add frame limit to mp2t_find_next_pcr, and handle timeout correctly
Change-Id: I02fab252bed3c4d0b134c2e61ea6f3338e21637b Reviewed-on: https://code.wireshark.org/review/15114 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wiretap/mp2t.c')
-rw-r--r--wiretap/mp2t.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c
index f2181aa0b4..aa24549f39 100644
--- a/wiretap/mp2t.c
+++ b/wiretap/mp2t.c
@@ -160,10 +160,6 @@ mp2t_read_pcr(guint8 *buffer)
return (base * 300 + ext);
}
-/*
- * XXX - should we limit this to a fixed number of frames, rather than
- * potentially scanning the entire file for a PCR?
- */
static gboolean
mp2t_find_next_pcr(wtap *wth, guint8 trailer_len,
int *err, gchar **err_info, guint32 *idx, guint64 *pcr, guint16 *pid)
@@ -171,9 +167,10 @@ mp2t_find_next_pcr(wtap *wth, guint8 trailer_len,
guint8 buffer[MP2T_SIZE+TRAILER_LEN_MAX];
gboolean found;
guint8 afc;
+ guint timeout = 0;
found = FALSE;
- while (FALSE == found) {
+ while (FALSE == found && timeout++ < SYNC_STEPS * SYNC_STEPS) {
(*idx)++;
if (!wtap_read_bytes_or_eof(
wth->fh, buffer, MP2T_SIZE+trailer_len, err, err_info)) {
@@ -207,7 +204,7 @@ mp2t_find_next_pcr(wtap *wth, guint8 trailer_len,
found = TRUE;
}
- return TRUE;
+ return found;
}
static wtap_open_return_val