diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-03-14 12:55:57 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-03-14 13:00:14 +0200 |
commit | 3f0a13d52a1f185a3f7d48bce7dbd50db5a6ba24 (patch) | |
tree | efdf29c5f37898d28d652f39fd388c5b4057df6b | |
parent | c2a35eef15de3d30edd44de2615a69585da572da (diff) |
validate: Fix overflow seek position comparision
MAX(0, ((gint64) priv->segment_start - priv->seek_pos_tol) will be a high
positive number thanks to being interpreted as unsigned values if
segment_start < seek_pos_tol. Fix this by explicitly checking for this case
and only doing the subtraction otherwise.
This fixes the problem from fdccffbb2e5885b3f8e7369cdbda45b6717ffab0
completely now.
https://bugzilla.gnome.org/show_bug.cgi?id=763602
-rw-r--r-- | validate/gst/validate/gst-validate-scenario.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 5fd8f25..fecc3fd 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -1046,8 +1046,8 @@ _check_position (GstValidateScenario * scenario, GstValidateAction * act, GST_TIME_ARGS (*position)); /* Check if playback is within seek segment */ - start_with_tolerance = - MAX (0, (gint64) (priv->segment_start - priv->seek_pos_tol)); + start_with_tolerance = (priv->segment_start < + priv->seek_pos_tol) ? 0 : priv->segment_start - priv->seek_pos_tol; stop_with_tolerance = GST_CLOCK_TIME_IS_VALID (priv->segment_stop) ? priv->segment_stop + priv->seek_pos_tol : -1; @@ -1071,11 +1071,13 @@ _check_position (GstValidateScenario * scenario, GstValidateAction * act, if (priv->seeked_in_pause && priv->seek_flags & GST_SEEK_FLAG_ACCURATE) { if ((rate > 0 && (*position >= priv->segment_start + priv->seek_pos_tol || - *position < MAX (0, - ((gint64) priv->segment_start - priv->seek_pos_tol)))) + *position < (priv->segment_start < + priv->seek_pos_tol) ? 0 : priv->segment_start - + priv->seek_pos_tol)) || (rate < 0 && (*position > priv->segment_start + priv->seek_pos_tol - || *position < MAX (0, - (gint64) priv->segment_start - priv->seek_pos_tol)))) { + || *position < (priv->segment_start < + priv->seek_pos_tol) ? 0 : priv->segment_start - + priv->seek_pos_tol))) { priv->seeked_in_pause = FALSE; GST_VALIDATE_REPORT (scenario, EVENT_SEEK_RESULT_POSITION_WRONG, "Reported position after accurate seek in PAUSED state should be exactly" |