diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-23 10:14:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-23 10:14:05 +0200 |
commit | eb4205cc89576d15cde6107e0f5dc0fabed29c40 (patch) | |
tree | f2cdbcb28d9af9a68ce72d4160ea7d2840320200 /libswscale | |
parent | fdb48225592c593892ffbe799847ff0867253d2a (diff) | |
download | ffmpeg-eb4205cc89576d15cde6107e0f5dc0fabed29c40.tar.gz |
swscale/utils: check mprotect() return code
Found-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/utils.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 9b2b5e9279..0743ee3531 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1430,8 +1430,11 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, c->hChrFilter, (uint32_t*)c->hChrFilterPos, 4); #if USE_MMAP - mprotect(c->lumMmxextFilterCode, c->lumMmxextFilterCodeSize, PROT_EXEC | PROT_READ); - mprotect(c->chrMmxextFilterCode, c->chrMmxextFilterCodeSize, PROT_EXEC | PROT_READ); + if ( mprotect(c->lumMmxextFilterCode, c->lumMmxextFilterCodeSize, PROT_EXEC | PROT_READ) == -1 + || mprotect(c->chrMmxextFilterCode, c->chrMmxextFilterCodeSize, PROT_EXEC | PROT_READ) == -1) { + av_log(c, AV_LOG_ERROR, "mprotect failed, cannot use fast bilinear scaler\n"); + goto fail; + } #endif } else #endif /* HAVE_MMXEXT_INLINE */ |