summaryrefslogtreecommitdiff
path: root/wiretap/mp2t.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiretap/mp2t.c')
-rw-r--r--wiretap/mp2t.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c
index 79d38e1dbd..44ee0b728c 100644
--- a/wiretap/mp2t.c
+++ b/wiretap/mp2t.c
@@ -276,7 +276,10 @@ mp2t_bits_per_second(wtap *wth, guint32 first, guint8 trailer_len,
return WTAP_OPEN_NOT_MINE;
}
pcr_delta = pcr2 - pcr1;
- bits_passed = MP2T_SIZE * (pn2 - pn1) * 8;
+ /* cast one of the factors to guint64
+ otherwise, the multiplication would use guint32 and could
+ overflow before the result is assigned to the guint64 bits_passed */
+ bits_passed = (guint64)MP2T_SIZE * (pn2 - pn1) * 8;
*bitrate = ((MP2T_PCR_CLOCK * bits_passed) / pcr_delta);
if (*bitrate == 0) {