diff options
author | Vineeth TM <vineeth.tm@samsung.com> | 2015-12-16 08:25:19 +0900 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-12-16 09:33:25 +0100 |
commit | 50978ccd1ae2e4055d40112aa4e019b48f1952eb (patch) | |
tree | 2a37f4f65043c5ade071928f2c7ea43c504661a3 /gst/yadif | |
parent | eb7deb44181ed3bebc57de32ab43119add9633e8 (diff) | |
download | gstreamer-plugins-bad-50978ccd1ae2e4055d40112aa4e019b48f1952eb.tar.gz |
yadif: Fix illegal memory access
When applying the spatial prediction, there is an illegal access of -1 index of array.
Hence adding a condition to avoid this.
https://bugzilla.gnome.org/show_bug.cgi?id=759518
Diffstat (limited to 'gst/yadif')
-rw-r--r-- | gst/yadif/vf_yadif.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gst/yadif/vf_yadif.c b/gst/yadif/vf_yadif.c index 82e9e9e69..a0bec4a36 100644 --- a/gst/yadif/vf_yadif.c +++ b/gst/yadif/vf_yadif.c @@ -56,12 +56,15 @@ int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; \ int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); \ int spatial_pred = (c+e) >> 1; \ - int spatial_score = FFABS(cur[mrefs - 1] - cur[prefs - 1]) + FFABS(c-e) \ - + FFABS(cur[mrefs + 1] - cur[prefs + 1]) - 1; \ + int spatial_score = -1; \ \ - CHECK(-1) CHECK(-2) }} }} \ - CHECK( 1) CHECK( 2) }} }} \ + if (mrefs > 0 && prefs > 0) { \ + spatial_score = FFABS(cur[mrefs - 1] - cur[prefs - 1]) + FFABS(c-e) \ + + FFABS(cur[mrefs + 1] - cur[prefs + 1]) - 1; \ \ + CHECK(-1) CHECK(-2) }} }} \ + CHECK( 1) CHECK( 2) }} }} \ + } \ if (mode < 2) { \ int b = (prev2[2 * mrefs] + next2[2 * mrefs])>>1; \ int f = (prev2[2 * prefs] + next2[2 * prefs])>>1; \ |