allow config options to limit max size of decode

This is a practical concern to allow us to fail in a decoder instance
if the size of a file is bigger than we can reasonably handle.

Change-Id: I0446b5502b1f8a48408107648ff2a8d187dca393
This commit is contained in:
Jim Bankoski
2014-07-17 06:31:50 -07:00
committed by Gerrit Code Review
parent 1a01194ab5
commit 943e43273b
9 changed files with 152 additions and 3 deletions

View File

@@ -485,6 +485,7 @@ EOF
print_config_h ARCH "${TMP_H}" ${ARCH_LIST}
print_config_h HAVE "${TMP_H}" ${HAVE_LIST}
print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST}
print_config_vars_h "${TMP_H}" ${VAR_LIST}
echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H}
mkdir -p `dirname "$1"`
cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1"
@@ -550,6 +551,15 @@ process_common_cmdline() {
|| die "Must be yasm, nasm or auto: ${optval}"
alt_as="${optval}"
;;
--size-limit=*)
w="${optval%%x*}"
h="${optval##*x}"
VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}"
[ ${w} -gt 0 -a ${h} -gt 0 ] || die "Invalid size-limit: too small."
[ ${w} -lt 65536 -a ${h} -lt 65536 ] \
|| die "Invalid size-limit: too big."
enable_feature size_limit
;;
--prefix=*)
prefix="${optval}"
;;
@@ -1324,6 +1334,16 @@ print_config_h() {
done
}
print_config_vars_h() {
local header=$1
shift
while [ $# -gt 0 ]; do
upname="`toupper $1`"
echo "#define ${upname} $2" >> $header
shift 2
done
}
print_webm_license() {
local destination=$1
local prefix="$2"