From af354dbef392c5eb0eb5481e3c6e300c12e7e8e8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 27 Nov 2008 16:47:41 +0000 Subject: [PATCH] gst-libs/gst/audio/gstbaseaudiosrc.c: Avoid nasty int overflows after about 12 hours and 25 minutes when these code p... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_get_offset), (gst_base_audio_src_create): Avoid nasty int overflows after about 12 hours and 25 minutes when these code paths are triggered. A free beer to Håvard Graff for finding this! --- ChangeLog | 8 ++++++++ gst-libs/gst/audio/gstbaseaudiosrc.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30244c2..e796333 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2008-11-27 Wim Taymans + * gst-libs/gst/audio/gstbaseaudiosrc.c: + (gst_base_audio_src_get_offset), (gst_base_audio_src_create): + Avoid nasty int overflows after about 12 hours and 25 minutes when these + code paths are triggered. + A free beer to Håvard Graff for finding this! + +2008-11-27 Wim Taymans + Patch by: 이문형 * gst-libs/gst/rtsp/gstrtspconnection.c: diff --git a/gst-libs/gst/audio/gstbaseaudiosrc.c b/gst-libs/gst/audio/gstbaseaudiosrc.c index 21a8de6..369551b 100644 --- a/gst-libs/gst/audio/gstbaseaudiosrc.c +++ b/gst-libs/gst/audio/gstbaseaudiosrc.c @@ -718,7 +718,7 @@ gst_base_audio_src_get_offset (GstBaseAudioSrc * src) if (diff >= segtotal) { GST_DEBUG_OBJECT (src, "dropped, align to segment %d", segdone); /* sample would be dropped, position to next playable position */ - sample = (segdone - segtotal + 1) * sps; + sample = ((guint64) (segdone - segtotal + 1)) * sps; } return sample; @@ -922,7 +922,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length, ringbuffer->segbase -= segment_diff; /* we calculate the new sample value */ - new_sample = new_first_segment * sps; + new_sample = ((guint64) new_first_segment) * sps; /* and get the relative time to this -> our new timestamp */ timestamp = -- 2.7.4