Compare commits

..

45 Commits

Author SHA1 Message Date
Michael Niedermayer
6f9e6ac6aa update for 0.10.12
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 19:00:59 +01:00
Michael Niedermayer
43b1762ab8 avcodec/snow: split block clipping checks
Fixes out of array read
Fixes: d4476f68ca1c1c57afbc45806f581963-asan_heap-oob_2266b27_8607_cov_4044577381_snow_chroma_bug.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 61d59703c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
f157f18b34 avcodec/msrle: use av_image_get_linesize() to calculate the linesize
Fixes out of array access
Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c919e1ca2e)

Conflicts:

	libavcodec/msrle.c
(cherry picked from commit bc1c8ec5e6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
68b14c044a avformat/mpegtsenc: Check data array size in mpegts_write_pmt()
Prevents out of array writes

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 842b6c14bc)

Conflicts:

	libavformat/mpegtsenc.c
(cherry picked from commit e87de3f50b765134588d0b048c32ed4b8acc16fb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ae51d93983 avcodec/wmalosslessdec: fix mclms_coeffs* array size
Fixes corruption of context
Fixes: 8835659dde6a4f7dcdf341de6a45c6c8-signal_sigsegv_1dce67b_4564_cov_2504444599_classical_22_16_1_14000_v3c_0_extend_0_29.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ec9578d54d)

Conflicts:

	libavcodec/wmalosslessdec.c
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ca8c3ec11b wmalosslessdec: make mclms arrays big enough for whats written into them.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a0abefb0af)

Conflicts:

	libavcodec/wmalosslessdec.c
2014-03-10 18:51:50 +01:00
Michael Niedermayer
4e47ae4e71 avcodec/vc1: reset fcm/field_mode in non advanced header parsing
Fixes NULL pointer dereference
Fixes: signal_sigsegv_1ab8bf4_2847_cov_4254117347_SA10091.vc1
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b51e935477)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
5cab56dc9e avcodec/vmnc: Check that rectangles are within the picture
Prevents out of array accesses with CODEC_FLAG_EMU_EDGE

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6ba02602aa)

Conflicts:

	libavcodec/vmnc.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7c17207ab9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
98f44b24b5 dnxhdenc: fix mb_rc size
Fixes out of array access with RC_VARIANCE set to 0

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f1caaa1c61)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ad4963a944 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  arm: hpeldsp: fix put_pixels8_y2_{,no_rnd_}armv6
  arm: hpeldsp: prevent overreads in armv6 asm
  lagarith: reallocate rgb_planes when needed
  lagarith: avoid infinite loop in lag_rac_refill()

Conflicts:
	libavcodec/lagarith.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:48:51 +01:00
Michael Niedermayer
5640ea43d7 Merge commit '2c1d84499bfe06d75e9160b824eeffd9f5587337' into release/0.10
* commit '2c1d84499bfe06d75e9160b824eeffd9f5587337':
  lagarith: pad RGB buffer by 1 byte.
  truemotion1: check the header size
  shorten: pad the internal bitstream buffer
  samplefmt: avoid integer overflow in av_samples_get_buffer_size()
  h264: Fix a typo from the previous commit
  h264: Lower bound check for slice offsets
  rpza: limit the number of blocks to the total remaining blocks in the frame

Conflicts:
	libavcodec/lagarith.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:39:02 +01:00
Michael Niedermayer
15efd9a7c0 Merge commit '36017d49e2f797f7371dc24848a2285ca63e39ab' into release/0.10
* commit '36017d49e2f797f7371dc24848a2285ca63e39ab':
  Prepare for 0.8.11 Release
  lavf: make av_probe_input_buffer more robust
  Updated Changelog for 0.8.10
  oggparseogm: check timing variables
  mathematics: remove asserts from av_rescale_rnd()
  vc1: Always reset numref when parsing a new frame header.
  h264: reset num_reorder_frames if it is invalid

Conflicts:
	RELEASE
	libavcodec/vc1.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:31:07 +01:00
Michael Niedermayer
0d82c3a0ca Merge commit '979f77b0dc40571761999633a38d97be9a1670c8' into release/0.10
* commit '979f77b0dc40571761999633a38d97be9a1670c8':
  h264: check that an IDR NAL only contains I slices
  mov: Free an earlier allocated array if allocating a new one
  segafilm: fix leaks if reading the header fails
  h264_cavlc: check the size of the intra PCM data.
  cavs: Check for negative cbp
  avi: DV in AVI must be considered single stream
  avutil: use align == 0 for default alignment in audio sample buffer functions

Conflicts:
	libavcodec/cavsdec.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:14:20 +01:00
Michael Niedermayer
b7a750f67f Merge commit 'cb5d0ea0bec119ecbe327bd7d3834987ab42ec1a' into release/0.10
* commit 'cb5d0ea0bec119ecbe327bd7d3834987ab42ec1a':
  flashsv: Check diff_start diff_height values
  dsputil/pngdsp: fix signed/unsigned type in end comparison
  vqavideo: check chunk sizes before reading chunks
  avi: directly resync on DV in AVI read failure
  get_bits: change the failure condition in init_get_bits
  twinvq: Cope with gcc-4.8.2 miscompilation

Conflicts:
	libavcodec/dsputil.c
	libavcodec/flashsv.c
	libavcodec/get_bits.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:06:35 +01:00
Janne Grunau
0120e480bf arm: hpeldsp: fix put_pixels8_y2_{,no_rnd_}armv6
The overread avoidance fix in cbddee1cca
broke the computation for the last row since it prevented the safe
reading from the height+1-th row.
2014-03-09 00:31:31 +01:00
Janne Grunau
fd2fc130b2 arm: hpeldsp: prevent overreads in armv6 asm
Based on a patch by Russel King <rmk+libav@arm.linux.org.uk>

Bug-Id: 646
CC: libav-stable@libav.org
2014-03-06 09:06:39 +01:00
Anton Khirnov
3da4fdd5ac lagarith: reallocate rgb_planes when needed
Fixes invalid writes on pixel format changes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 4c3e1956ee)
(cherry picked from commit bd57e783437f990c3ac4747eeebe20332e103980)
2014-02-28 23:07:41 -05:00
Ronald S. Bultje
2c1d84499b lagarith: pad RGB buffer by 1 byte.
For left HFYU prediction, we predict from the buffer buf+1 using 8- or
16-byte reads. This means that aligning the buffer by 16 bytes is in
itself not sufficient, because if the width itself is 16- or 8-byte
aligned, the buffer will not be padded, and thus a read of size 16 at
buf+1 will overflow boundaries at the right edge. Padding the buffer by
1 byte is sufficient to not overflow its boundaries.

Fixes bug 342.

(cherry picked from commit 98d0d19208)
2014-02-28 23:07:40 -05:00
Anton Khirnov
2fb0a52e70 lagarith: avoid infinite loop in lag_rac_refill()
range == 0 happens with corrupted files

CC:libav-stable@libav.org
(cherry picked from commit de6dfa2bb8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 8bce2c60b8)
2014-02-28 23:07:40 -05:00
Anton Khirnov
de0e442e9d truemotion1: check the header size
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 2240e2078d)
(cherry picked from commit 76b40a9bf93e387d98aa7dc02ec7a8d13f51722f)
2014-02-28 23:07:40 -05:00
Anton Khirnov
43aa7eb38e shorten: pad the internal bitstream buffer
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 1713eec29a)
(cherry picked from commit 5881ec0ea58a95403bd375b63f22d49905cdd8e5)
2014-02-28 23:07:40 -05:00
Justin Ruggles
9786c24bb7 samplefmt: avoid integer overflow in av_samples_get_buffer_size()
CC:libav-stable@libav.org
(cherry picked from commit 0e830094ad)
(cherry picked from commit e9b3abd49890e958c745ea46a9f4f91b6b4baa58)

Conflicts:
	libavutil/samplefmt.c
2014-02-28 23:07:40 -05:00
Luca Barbato
4279e0e8d0 h264: Fix a typo from the previous commit
f777504f64 changed a - in +

CC: libav-stable@libav.org
(cherry picked from commit d922c5a5fb)
(cherry picked from commit 3ce77e04c2ca4b9e7fa6b94b51e8d7c5f188da86)
(cherry picked from commit 8cba6f58c8acaa0ca6749110a2746bbe60ff2dab)
2014-02-28 23:07:40 -05:00
Vittorio Giovara
a6003760bd h264: Lower bound check for slice offsets
And use the value from the specification.

Sample-Id: 00000451-google
Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit f777504f64)
(cherry picked from commit 5bd083d0216d9ee649039c84999fb61386536ac1)

Conflicts:
	libavcodec/h264.c

(cherry picked from commit 41380e017afcca3119acb560c08a60a97d416c3c)

Conflicts:
	libavcodec/h264.c
2014-02-28 23:07:40 -05:00
Anton Khirnov
cf676c159b rpza: limit the number of blocks to the total remaining blocks in the frame
Fixes invalid writes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 77bb0004bb)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-02-14 11:43:59 +01:00
Reinhard Tartler
36017d49e2 Prepare for 0.8.11 Release 2014-02-06 23:26:33 -05:00
Anton Khirnov
8cade1352b lavf: make av_probe_input_buffer more robust
Always use the actually read size as the offset instead of making
possibly invalid assumptions.

Addresses: CVE-2012-6618

(cherry picked from commit 2115a35974)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavformat/utils.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 8575f5362f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-06 23:01:14 -05:00
Reinhard Tartler
5522c564d4 Updated Changelog for 0.8.10 2014-02-02 12:54:52 -05:00
Anton Khirnov
b0db7a523d oggparseogm: check timing variables
Fixes a potential divide by zero.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 75647dea6f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit bf7c240a50)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:58 -05:00
Anton Khirnov
e03b875c0b mathematics: remove asserts from av_rescale_rnd()
It is a public function, it must not assert on its parameters.

(cherry picked from commit 94a417acc0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 03bfd8419f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:45 -05:00
Michael Niedermayer
30c8a5e4f6 vc1: Always reset numref when parsing a new frame header.
Fixes an issue where the B-frame coding mode switches from interlaced
fields to interlaced frames, causing incorrect decisions in the motion
compensation code and resulting in visual artifacts.

CC: libav-stable@libav.org
Signed-off-by: Tim Walker <tdskywalker@gmail.com>
(cherry picked from commit dd2d0039b6)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 3cc8d9bc1f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:34 -05:00
Anton Khirnov
716ee73c99 h264: reset num_reorder_frames if it is invalid
An invalid VUI is not considered a fatal error, so the SPS containing it
may still be used. Leaving an invalid value of num_reorder_frames there
can result in writing over the bounds of H264Context.delayed_pic.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 9ecabd7892)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/h264_ps.c

(cherry picked from commit 299c5dcfb0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:16 -05:00
Anton Khirnov
979f77b0dc h264: check that an IDR NAL only contains I slices
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 8b2e5e42bb)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 62ed6da016)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/h264.c
2014-02-02 12:48:04 -05:00
Martin Storsjö
2f4e066d66 mov: Free an earlier allocated array if allocating a new one
It could probably also be considered an error if the pointer isn't
null at this point, but then we might risk rejecting some
slightly broken files that we might have handled so far.

Sample-Id: 00000496-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 2620df1310)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit a1b4d42d31)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:45:09 -05:00
Anton Khirnov
6a56d16dc1 segafilm: fix leaks if reading the header fails
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 6892d145a0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f728782c0d)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavformat/segafilm.c
2014-02-02 12:44:20 -05:00
Anton Khirnov
23144c5f06 h264_cavlc: check the size of the intra PCM data.
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

(cherry picked from commit b5275ca1a8)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:41:02 -05:00
Luca Barbato
e964207e6c cavs: Check for negative cbp
Sample-Id: 00000647-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c85e5f13f6)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/cavsdec.c
2014-02-02 12:36:15 -05:00
Luca Barbato
2c0bfce4cb avi: DV in AVI must be considered single stream
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3485a07977)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:29:54 -05:00
Justin Ruggles
b68e5b1195 avutil: use align == 0 for default alignment in audio sample buffer functions
Fixes: http://pad.lv/1264886, http://pad.lv/1241439
(cherry picked from commit 0109a09dc3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavutil/avutil.h
2014-02-01 14:59:12 -05:00
Michael Niedermayer
cb5d0ea0be flashsv: Check diff_start diff_height values
Fix out of array accesses.

Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Adresses: CVE-2013-7015
(cherry picked from commit 57070b1468)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 10d48fe6d3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:06:24 -05:00
Michael Niedermayer
ef6c90e102 dsputil/pngdsp: fix signed/unsigned type in end comparison
Fixes out of array accesses and integer overflows.

(cherry picked from commit d1916d13e2)
Adresses: CVE-2013-7010, CVE-2013-7014

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit af9799790d)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/pngdsp.c
2014-02-01 14:05:47 -05:00
Michael Niedermayer
d04194db45 vqavideo: check chunk sizes before reading chunks
Fixes out of array writes

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ab6c9332bf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 13093f9767)

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f7d18deb73)

Addresses: CVE-2013-0865

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit ab434bf0d0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:03:28 -05:00
Luca Barbato
976a7b72a3 avi: directly resync on DV in AVI read failure
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ceec6e792e)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Adresses CVE-2013-0856
(cherry picked from commit 61057f4604)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:02:20 -05:00
Luca Barbato
a89acaa0b0 get_bits: change the failure condition in init_get_bits
Too much code relies in having init_get_bits fed with a valid
buffer and set its dimension to 0.

Check for NULL buffer instead.

(cherry picked from commit 4603ec85ed)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-25 01:01:25 +01:00
Luca Barbato
8b24e17d09 twinvq: Cope with gcc-4.8.2 miscompilation
Apparently gcc-4.8.2 miscompiles enums resulting in a lucky fpe soon
after it.

Passing the enum value as integer makes the ftype == FT_PPC condition
evaluates correctly.
2014-01-07 14:21:53 +01:00
35 changed files with 171 additions and 83 deletions

View File

@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 0.10.11 PROJECT_NUMBER = 0.10.12
# With the PROJECT_LOGO tag one can specify an logo or icon that is included # With the PROJECT_LOGO tag one can specify an logo or icon that is included
# in the documentation. The maximum height of the logo should not exceed 55 # in the documentation. The maximum height of the logo should not exceed 55

View File

@@ -1 +1 @@
0.10.11 0.10.12

View File

@@ -1 +1 @@
0.10.11 0.10.12

View File

@@ -132,6 +132,13 @@ T ldr \rt, [\rn]
T add \rn, \rn, \rm T add \rn, \rn, \rm
.endm .endm
.macro ldrc_pre cc, rt, rn, rm:vararg
A ldr\cc \rt, [\rn, \rm]!
T itt \cc
T add\cc \rn, \rn, \rm
T ldr\cc \rt, [\rn]
.endm
.macro ldrd_reg rt, rt2, rn, rm .macro ldrd_reg rt, rt2, rn, rm
A ldrd \rt, \rt2, [\rn, \rm] A ldrd \rt, \rt2, [\rn, \rm]
T add \rt, \rn, \rm T add \rt, \rn, \rm

View File

@@ -146,10 +146,11 @@ function ff_put_pixels8_y2_armv6, export=1
eor r7, r5, r7 eor r7, r5, r7
uadd8 r10, r10, r6 uadd8 r10, r10, r6
and r7, r7, r12 and r7, r7, r12
ldr_pre r6, r1, r2 ldrc_pre ne, r6, r1, r2
uadd8 r11, r11, r7 uadd8 r11, r11, r7
strd_post r8, r9, r0, r2 strd_post r8, r9, r0, r2
ldr r7, [r1, #4] it ne
ldrne r7, [r1, #4]
strd_post r10, r11, r0, r2 strd_post r10, r11, r0, r2
bne 1b bne 1b
@@ -198,9 +199,10 @@ function ff_put_pixels8_y2_no_rnd_armv6, export=1
uhadd8 r9, r5, r7 uhadd8 r9, r5, r7
ldr r5, [r1, #4] ldr r5, [r1, #4]
uhadd8 r12, r4, r6 uhadd8 r12, r4, r6
ldr_pre r6, r1, r2 ldrc_pre ne, r6, r1, r2
uhadd8 r14, r5, r7 uhadd8 r14, r5, r7
ldr r7, [r1, #4] it ne
ldrne r7, [r1, #4]
stm r0, {r8,r9} stm r0, {r8,r9}
add r0, r0, r2 add r0, r0, r2
stm r0, {r12,r14} stm r0, {r12,r14}

View File

@@ -166,8 +166,8 @@ static inline int decode_residual_inter(AVSContext *h) {
/* get coded block pattern */ /* get coded block pattern */
int cbp= get_ue_golomb(&h->s.gb); int cbp= get_ue_golomb(&h->s.gb);
if(cbp > 63U){ if(cbp > 63 || cbp < 0){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal inter cbp\n"); av_log(h->s.avctx, AV_LOG_ERROR, "illegal inter cbp %d\n", cbp);
return -1; return -1;
} }
h->cbp = cbp_tab[cbp][1]; h->cbp = cbp_tab[cbp][1];
@@ -226,7 +226,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code) {
/* get coded block pattern */ /* get coded block pattern */
if(h->pic_type == AV_PICTURE_TYPE_I) if(h->pic_type == AV_PICTURE_TYPE_I)
cbp_code = get_ue_golomb(gb); cbp_code = get_ue_golomb(gb);
if(cbp_code > 63U){ if(cbp_code > 63 || cbp_code < 0 ){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n"); av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n");
return -1; return -1;
} }

View File

@@ -220,7 +220,7 @@ static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
static int dnxhd_init_rc(DNXHDEncContext *ctx) static int dnxhd_init_rc(DNXHDEncContext *ctx)
{ {
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail); FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*(ctx->m.avctx->qmax + 1)*sizeof(RCEntry), fail);
if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail); FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);

View File

@@ -1912,7 +1912,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
long i; long i;
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){ for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) {
long a = *(long*)(src+i); long a = *(long*)(src+i);
long b = *(long*)(dst+i); long b = *(long*)(dst+i);
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
@@ -1937,7 +1937,7 @@ static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
} }
}else }else
#endif #endif
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){ for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) {
long a = *(long*)(src1+i); long a = *(long*)(src1+i);
long b = *(long*)(src2+i); long b = *(long*)(src2+i);
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80); *(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);

View File

@@ -389,7 +389,9 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
s->diff_start = get_bits(&gb, 8); s->diff_start = get_bits(&gb, 8);
s->diff_height = get_bits(&gb, 8); s->diff_height = get_bits(&gb, 8);
if (s->diff_start + s->diff_height > cur_blk_height) { if (s->diff_start + s->diff_height > cur_blk_height) {
av_log(avctx, AV_LOG_ERROR, "Block parameters invalid\n"); av_log(avctx, AV_LOG_ERROR,
"Block parameters invalid: %d + %d > %d\n",
s->diff_start, s->diff_height, cur_blk_height);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
av_log(avctx, AV_LOG_DEBUG, av_log(avctx, AV_LOG_DEBUG,

View File

@@ -355,7 +355,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
int buffer_size; int buffer_size;
int ret = 0; int ret = 0;
if (bit_size > INT_MAX - 7 || bit_size < 0) { if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
buffer_size = bit_size = 0; buffer_size = bit_size = 0;
buffer = NULL; buffer = NULL;
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;

View File

@@ -2672,7 +2672,14 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
h->slice_type= slice_type; h->slice_type= slice_type;
h->slice_type_nos= slice_type & 3; h->slice_type_nos= slice_type & 3;
s->pict_type= h->slice_type; // to make a few old functions happy, it's wrong though if (h->nal_unit_type == NAL_IDR_SLICE &&
h->slice_type_nos != AV_PICTURE_TYPE_I) {
av_log(h->s.avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n");
return AVERROR_INVALIDDATA;
}
// to make a few old functions happy, it's wrong though
s->pict_type = h->slice_type;
pps_id= get_ue_golomb(&s->gb); pps_id= get_ue_golomb(&s->gb);
if(pps_id>=MAX_PPS_COUNT){ if(pps_id>=MAX_PPS_COUNT){
@@ -3224,8 +3231,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
} }
h->deblocking_filter = 1; h->deblocking_filter = 1;
h->slice_alpha_c0_offset = 52; h->slice_alpha_c0_offset = 0;
h->slice_beta_offset = 52; h->slice_beta_offset = 0;
if( h->pps.deblocking_filter_parameters_present ) { if( h->pps.deblocking_filter_parameters_present ) {
tmp= get_ue_golomb_31(&s->gb); tmp= get_ue_golomb_31(&s->gb);
if(tmp > 2){ if(tmp > 2){
@@ -3236,12 +3243,16 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if(h->deblocking_filter < 2) if(h->deblocking_filter < 2)
h->deblocking_filter^= 1; // 1<->0 h->deblocking_filter^= 1; // 1<->0
if( h->deblocking_filter ) { if (h->deblocking_filter) {
h->slice_alpha_c0_offset += get_se_golomb(&s->gb) << 1; h->slice_alpha_c0_offset = get_se_golomb(&s->gb) * 2;
h->slice_beta_offset += get_se_golomb(&s->gb) << 1; h->slice_beta_offset = get_se_golomb(&s->gb) * 2;
if( h->slice_alpha_c0_offset > 104U if (h->slice_alpha_c0_offset > 12 ||
|| h->slice_beta_offset > 104U){ h->slice_alpha_c0_offset < -12 ||
av_log(s->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", h->slice_alpha_c0_offset, h->slice_beta_offset); h->slice_beta_offset > 12 ||
h->slice_beta_offset < -12) {
av_log(s->avctx, AV_LOG_ERROR,
"deblocking filter parameters %d %d out of range\n",
h->slice_alpha_c0_offset, h->slice_beta_offset);
return -1; return -1;
} }
} }
@@ -3270,14 +3281,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
} }
} }
} }
h->qp_thresh = 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) h->qp_thresh = 15 -
- FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]) FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) -
+ 6 * (h->sps.bit_depth_luma - 8); FFMAX3(0,
h->pps.chroma_qp_index_offset[0],
#if 0 //FMO h->pps.chroma_qp_index_offset[1]) +
if( h->pps.num_slice_groups > 1 && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5) 6 * (h->sps.bit_depth_luma - 8);
slice_group_change_cycle= get_bits(&s->gb, ?);
#endif
h0->last_slice_type = slice_type; h0->last_slice_type = slice_type;
h->slice_num = ++h0->current_slice; h->slice_num = ++h0->current_slice;
@@ -3338,7 +3347,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1], s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1],
h->ref_count[0], h->ref_count[1], h->ref_count[0], h->ref_count[1],
s->qscale, s->qscale,
h->deblocking_filter, h->slice_alpha_c0_offset/2-26, h->slice_beta_offset/2-26, h->deblocking_filter,
h->slice_alpha_c0_offset, h->slice_beta_offset,
h->use_weight, h->use_weight,
h->use_weight==1 && h->use_weight_chroma ? "c" : "", h->use_weight==1 && h->use_weight_chroma ? "c" : "",
h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "" h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""

View File

@@ -770,6 +770,10 @@ decode_intra_mb:
// We assume these blocks are very rare so we do not optimize it. // We assume these blocks are very rare so we do not optimize it.
align_get_bits(&s->gb); align_get_bits(&s->gb);
if (get_bits_left(&s->gb) < mb_size) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough data for an intra PCM block.\n");
return AVERROR_INVALIDDATA;
}
// The pixels are stored in the same order as levels in h->mb array. // The pixels are stored in the same order as levels in h->mb array.
for(x=0; x < mb_size; x++){ for(x=0; x < mb_size; x++){

View File

@@ -254,8 +254,8 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
int top_type= h->top_type; int top_type= h->top_type;
int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
int a = h->slice_alpha_c0_offset - qp_bd_offset; int a = 52 + h->slice_alpha_c0_offset - qp_bd_offset;
int b = h->slice_beta_offset - qp_bd_offset; int b = 52 + h->slice_beta_offset - qp_bd_offset;
int mb_type = s->current_picture.f.mb_type[mb_xy]; int mb_type = s->current_picture.f.mb_type[mb_xy];
int qp = s->current_picture.f.qscale_table[mb_xy]; int qp = s->current_picture.f.qscale_table[mb_xy];
@@ -715,8 +715,8 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint
av_unused int dir; av_unused int dir;
int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));
int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
int a = h->slice_alpha_c0_offset - qp_bd_offset; int a = 52 + h->slice_alpha_c0_offset - qp_bd_offset;
int b = h->slice_beta_offset - qp_bd_offset; int b = 52 + h->slice_beta_offset - qp_bd_offset;
if (FRAME_MBAFF if (FRAME_MBAFF
// and current and left pair do not have the same interlaced type // and current and left pair do not have the same interlaced type

View File

@@ -250,7 +250,9 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
} }
if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){ if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames); av_log(h->s.avctx, AV_LOG_ERROR, "Clipping illegal num_reorder_frames %d\n",
sps->num_reorder_frames);
sps->num_reorder_frames = 16;
return -1; return -1;
} }
} }

View File

@@ -52,6 +52,7 @@ typedef struct LagarithContext {
int zeros; /**< number of consecutive zero bytes encountered */ int zeros; /**< number of consecutive zero bytes encountered */
int zeros_rem; /**< number of zero bytes remaining to output */ int zeros_rem; /**< number of zero bytes remaining to output */
uint8_t *rgb_planes; uint8_t *rgb_planes;
int rgb_planes_allocated;
int rgb_stride; int rgb_stride;
} LagarithContext; } LagarithContext;
@@ -507,13 +508,12 @@ static int lag_decode_frame(AVCodecContext *avctx,
offs[2] = 13; offs[2] = 13;
offs[3] = AV_RL32(buf + 9); offs[3] = AV_RL32(buf + 9);
l->rgb_stride = FFALIGN(avctx->width, 16);
av_fast_malloc(&l->rgb_planes, &l->rgb_planes_allocated,
l->rgb_stride * avctx->height * 4 + 1);
if (!l->rgb_planes) { if (!l->rgb_planes) {
l->rgb_stride = FFALIGN(avctx->width, 16); av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * 4); return AVERROR(ENOMEM);
if (!l->rgb_planes) {
av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
return AVERROR(ENOMEM);
}
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride; srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride;

View File

@@ -107,6 +107,9 @@ static inline uint8_t lag_get_rac(lag_rac *l)
l->range -= range_scaled * l->prob[255]; l->range -= range_scaled * l->prob[255];
} }
if (!l->range)
l->range = 0x80;
l->low -= range_scaled * l->prob[val]; l->low -= range_scaled * l->prob[val];
return val; return val;

View File

@@ -35,6 +35,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "msrledec.h" #include "msrledec.h"
#include "libavutil/imgutils.h"
typedef struct MsrleContext { typedef struct MsrleContext {
AVCodecContext *avctx; AVCodecContext *avctx;
@@ -108,7 +109,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
/* FIXME how to correctly detect RLE ??? */ /* FIXME how to correctly detect RLE ??? */
if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
uint8_t *ptr = s->frame.data[0]; uint8_t *ptr = s->frame.data[0];
uint8_t *buf = avpkt->data + (avctx->height-1)*istride; uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
int i, j; int i, j;

View File

@@ -38,6 +38,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
@@ -125,6 +126,8 @@ static void rpza_decode_stream(RpzaContext *s)
} }
} }
n_blocks = FFMIN(n_blocks, total_blocks);
switch (opcode & 0xe0) { switch (opcode & 0xe0) {
/* Skip blocks */ /* Skip blocks */

View File

@@ -431,7 +431,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
void *tmp_ptr; void *tmp_ptr;
s->max_framesize = 1024; // should hopefully be enough for the first header s->max_framesize = 1024; // should hopefully be enough for the first header
tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size,
s->max_framesize); s->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE);
if (!tmp_ptr) { if (!tmp_ptr) {
av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n"); av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@@ -311,7 +311,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
if(!sliced && !offset_dst) if(!sliced && !offset_dst)
dst -= src_x; dst -= src_x;
src_x=0; src_x=0;
}else if(src_x + b_w > w){ }
if(src_x + b_w > w){
b_w = w - src_x; b_w = w - src_x;
} }
if(src_y<0){ if(src_y<0){
@@ -320,7 +321,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
if(!sliced && !offset_dst) if(!sliced && !offset_dst)
dst -= src_y*dst_stride; dst -= src_y*dst_stride;
src_y=0; src_y=0;
}else if(src_y + b_h> h){ }
if(src_y + b_h> h){
b_h = h - src_y; b_h = h - src_y;
} }

View File

@@ -320,6 +320,11 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
return -1; return -1;
} }
if (header.header_size + 1 > s->size) {
av_log(s->avctx, AV_LOG_ERROR, "Input packet too small.\n");
return AVERROR_INVALIDDATA;
}
/* unscramble the header bytes with a XOR operation */ /* unscramble the header bytes with a XOR operation */
memset(header_buffer, 0, 128); memset(header_buffer, 0, 128);
for (i = 1; i < header.header_size; i++) for (i = 1; i < header.header_size; i++)

View File

@@ -996,7 +996,7 @@ static void linear_perm(int16_t *out, int16_t *in, int n_blocks, int size)
out[i] = block_size * (in[i] % n_blocks) + in[i] / n_blocks; out[i] = block_size * (in[i] % n_blocks) + in[i] / n_blocks;
} }
static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype) static av_cold void construct_perm_table(TwinContext *tctx, int ftype)
{ {
int block_size; int block_size;
const ModeTab *mtab = tctx->mtab; const ModeTab *mtab = tctx->mtab;

View File

@@ -578,6 +578,8 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
{ {
int pqindex, lowquant, status; int pqindex, lowquant, status;
v->field_mode = 0;
v->fcm = 0;
if (v->finterpflag) if (v->finterpflag)
v->interpfrm = get_bits1(gb); v->interpfrm = get_bits1(gb);
skip_bits(gb, 2); //framecnt unused skip_bits(gb, 2); //framecnt unused
@@ -824,7 +826,7 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; /* useful only for debugging */ int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; /* useful only for debugging */
int scale, shift, i; /* for initializing LUT for intensity compensation */ int scale, shift, i; /* for initializing LUT for intensity compensation */
v->numref=0; v->numref = 0;
v->p_frame_skipped = 0; v->p_frame_skipped = 0;
if (v->second_field) { if (v->second_field) {
if(v->fcm!=2 || v->field_mode!=1) if(v->fcm!=2 || v->field_mode!=1)

View File

@@ -275,6 +275,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int
} }
xy = *src++; xy = *src++;
wh = *src++; wh = *src++;
if ( (xy >> 4) + (wh >> 4) + 1 > w - i
|| (xy & 0xF) + (wh & 0xF)+1 > h - j) {
av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n");
return AVERROR_INVALIDDATA;
}
paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride); paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
} }
} }

View File

@@ -534,6 +534,12 @@ static int vqa_decode_chunk(VqaContext *s)
bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET); bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET);
chunk_size = bytestream2_get_be32(&s->gb); chunk_size = bytestream2_get_be32(&s->gb);
if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
av_log(s->avctx, AV_LOG_ERROR, "cbp0 chunk too large (%u bytes)\n",
chunk_size);
return AVERROR_INVALIDDATA;
}
/* accumulate partial codebook */ /* accumulate partial codebook */
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index], bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
chunk_size); chunk_size);
@@ -557,6 +563,12 @@ static int vqa_decode_chunk(VqaContext *s)
bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET); bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET);
chunk_size = bytestream2_get_be32(&s->gb); chunk_size = bytestream2_get_be32(&s->gb);
if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
av_log(s->avctx, AV_LOG_ERROR, "cbpz chunk too large (%u bytes)\n",
chunk_size);
return AVERROR_INVALIDDATA;
}
/* accumulate partial codebook */ /* accumulate partial codebook */
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index], bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
chunk_size); chunk_size);

View File

@@ -238,11 +238,11 @@ typedef struct WmallDecodeCtx {
int8_t mclms_order; int8_t mclms_order;
int8_t mclms_scaling; int8_t mclms_scaling;
int16_t mclms_coeffs[128]; int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32];
int16_t mclms_coeffs_cur[4]; int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS];
int16_t mclms_prevvalues[64]; // FIXME: should be 32-bit / 16-bit depending on bit-depth int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32];
int16_t mclms_updates[64]; int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32];
int mclms_recent; int mclms_recent;
int movave_scaling; int movave_scaling;
int quant_stepsize; int quant_stepsize;

View File

@@ -940,7 +940,7 @@ start_sync:
goto start_sync; goto start_sync;
} }
n= get_stream_idx(d); n = avi->dv_demux ? 0 : get_stream_idx(d);
if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams) if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams)
continue; continue;
@@ -1051,6 +1051,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
int size = avpriv_dv_get_packet(avi->dv_demux, pkt); int size = avpriv_dv_get_packet(avi->dv_demux, pkt);
if (size >= 0) if (size >= 0)
return size; return size;
else
goto resync;
} }
if(avi->non_interleaved){ if(avi->non_interleaved){
@@ -1392,12 +1394,17 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
int64_t pos, pos_min; int64_t pos, pos_min;
AVIStream *ast; AVIStream *ast;
/* Does not matter which stream is requested dv in avi has the
* stream information in the first video stream.
*/
if (avi->dv_demux)
stream_index = 0;
if (!avi->index_loaded) { if (!avi->index_loaded) {
/* we only load the index on demand */ /* we only load the index on demand */
avi_load_index(s); avi_load_index(s);
avi->index_loaded |= 1; avi->index_loaded |= 1;
} }
assert(stream_index>= 0);
st = s->streams[stream_index]; st = s->streams[stream_index];
ast= st->priv_data; ast= st->priv_data;
@@ -1415,7 +1422,6 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
/* One and only one real stream for DV in AVI, and it has video */ /* One and only one real stream for DV in AVI, and it has video */
/* offsets. Calling with other stream indexes should have failed */ /* offsets. Calling with other stream indexes should have failed */
/* the av_index_search_timestamp call above. */ /* the av_index_search_timestamp call above. */
assert(stream_index == 0);
if(avio_seek(s->pb, pos, SEEK_SET) < 0) if(avio_seek(s->pb, pos, SEEK_SET) < 0)
return -1; return -1;

View File

@@ -1694,6 +1694,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (entries >= UINT_MAX / sizeof(*sc->stts_data)) if (entries >= UINT_MAX / sizeof(*sc->stts_data))
return -1; return -1;
av_free(sc->stts_data);
sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data)); sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
if (!sc->stts_data) if (!sc->stts_data)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@@ -235,7 +235,7 @@ static void mpegts_write_pat(AVFormatContext *s)
data, q - data); data, q - data);
} }
static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
{ {
// MpegTSWrite *ts = s->priv_data; // MpegTSWrite *ts = s->priv_data;
uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr; uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr;
@@ -288,6 +288,10 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
stream_type = STREAM_TYPE_PRIVATE_DATA; stream_type = STREAM_TYPE_PRIVATE_DATA;
break; break;
} }
if (q - data > sizeof(data) - 32)
return AVERROR(EINVAL);
*q++ = stream_type; *q++ = stream_type;
put16(&q, 0xe000 | ts_st->pid); put16(&q, 0xe000 | ts_st->pid);
desc_length_ptr = q; desc_length_ptr = q;
@@ -311,7 +315,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
len_ptr = q++; len_ptr = q++;
*len_ptr = 0; *len_ptr = 0;
for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { for (p = lang->value; next && *len_ptr < 255 / 4 * 4 && q - data < sizeof(data) - 4; p = next + 1) {
next = strchr(p, ','); next = strchr(p, ',');
if (strlen(p) != 3 && (!next || next != p + 3)) if (strlen(p) != 3 && (!next || next != p + 3))
continue; /* not a 3-letter code */ continue; /* not a 3-letter code */
@@ -373,6 +377,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
} }
mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0, mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0,
data, q - data); data, q - data);
return 0;
} }
/* NOTE: str == NULL is accepted for an empty string */ /* NOTE: str == NULL is accepted for an empty string */

View File

@@ -75,6 +75,11 @@ ogm_header(AVFormatContext *s, int idx)
time_unit = bytestream2_get_le64(&p); time_unit = bytestream2_get_le64(&p);
spu = bytestream2_get_le64(&p); spu = bytestream2_get_le64(&p);
if (!time_unit || !spu) {
av_log(s, AV_LOG_ERROR, "Invalid timing values.\n");
return AVERROR_INVALIDDATA;
}
bytestream2_skip(&p, 4); /* default_len */ bytestream2_skip(&p, 4); /* default_len */
bytestream2_skip(&p, 8); /* buffersize + bits_per_sample */ bytestream2_skip(&p, 8); /* buffersize + bits_per_sample */

View File

@@ -76,6 +76,16 @@ static int film_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_MAX;
} }
static int film_read_close(AVFormatContext *s)
{
FilmDemuxContext *film = s->priv_data;
av_freep(&film->sample_table);
av_freep(&film->stereo_buffer);
return 0;
}
static int film_read_header(AVFormatContext *s, static int film_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
@@ -83,7 +93,7 @@ static int film_read_header(AVFormatContext *s,
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
unsigned char scratch[256]; unsigned char scratch[256];
int i; int i, ret;
unsigned int data_offset; unsigned int data_offset;
unsigned int audio_frame_counter; unsigned int audio_frame_counter;
@@ -210,14 +220,16 @@ static int film_read_header(AVFormatContext *s,
for (i = 0; i < film->sample_count; i++) { for (i = 0; i < film->sample_count; i++) {
/* load the next sample record and transfer it to an internal struct */ /* load the next sample record and transfer it to an internal struct */
if (avio_read(pb, scratch, 16) != 16) { if (avio_read(pb, scratch, 16) != 16) {
av_free(film->sample_table); ret = AVERROR(EIO);
return AVERROR(EIO); goto fail;
} }
film->sample_table[i].sample_offset = film->sample_table[i].sample_offset =
data_offset + AV_RB32(&scratch[0]); data_offset + AV_RB32(&scratch[0]);
film->sample_table[i].sample_size = AV_RB32(&scratch[4]); film->sample_table[i].sample_size = AV_RB32(&scratch[4]);
if (film->sample_table[i].sample_size > INT_MAX / 4) if (film->sample_table[i].sample_size > INT_MAX / 4) {
return AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto fail;
}
if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) { if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) {
film->sample_table[i].stream = film->audio_stream_index; film->sample_table[i].stream = film->audio_stream_index;
film->sample_table[i].pts = audio_frame_counter; film->sample_table[i].pts = audio_frame_counter;
@@ -240,6 +252,9 @@ static int film_read_header(AVFormatContext *s,
film->current_sample = 0; film->current_sample = 0;
return 0; return 0;
fail:
film_read_close(s);
return ret;
} }
static int film_read_packet(AVFormatContext *s, static int film_read_packet(AVFormatContext *s,
@@ -320,16 +335,6 @@ static int film_read_packet(AVFormatContext *s,
return ret; return ret;
} }
static int film_read_close(AVFormatContext *s)
{
FilmDemuxContext *film = s->priv_data;
av_free(film->sample_table);
av_free(film->stereo_buffer);
return 0;
}
AVInputFormat ff_segafilm_demuxer = { AVInputFormat ff_segafilm_demuxer = {
.name = "film_cpk", .name = "film_cpk",
.long_name = NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"), .long_name = NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"),

View File

@@ -558,7 +558,6 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt; for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt;
probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) { probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) {
int score = probe_size < max_probe_size ? AVPROBE_SCORE_MAX/4 : 0; int score = probe_size < max_probe_size ? AVPROBE_SCORE_MAX/4 : 0;
int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1;
void *buftmp; void *buftmp;
if (probe_size < offset) { if (probe_size < offset) {
@@ -572,7 +571,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
buf=buftmp; buf=buftmp;
if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { if ((ret = avio_read(pb, buf + pd.buf_size, probe_size - pd.buf_size)) < 0) {
/* fail if error was not end of file, otherwise, lower score */ /* fail if error was not end of file, otherwise, lower score */
if (ret != AVERROR_EOF) { if (ret != AVERROR_EOF) {
av_free(buf); av_free(buf);

View File

@@ -23,7 +23,6 @@
* miscellaneous math routines and tables * miscellaneous math routines and tables
*/ */
#include <assert.h>
#include <stdint.h> #include <stdint.h>
#include <limits.h> #include <limits.h>
#include "mathematics.h" #include "mathematics.h"
@@ -77,9 +76,9 @@ int64_t av_gcd(int64_t a, int64_t b){
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){
int64_t r=0; int64_t r=0;
assert(c > 0);
assert(b >=0); if (c <= 0 || b < 0 || rnd == 4 || rnd > 5)
assert((unsigned)rnd<=5 && rnd!=4); return INT64_MIN;
if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1)); if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1));

View File

@@ -114,6 +114,13 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
if (!sample_size || nb_samples <= 0 || nb_channels <= 0) if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL); return AVERROR(EINVAL);
/* auto-select alignment if not specified */
if (!align) {
if (nb_samples > INT_MAX - 31)
return AVERROR(EINVAL);
align = 32;
}
/* check for integer overflow */ /* check for integer overflow */
if (nb_channels > INT_MAX / align || if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)

View File

@@ -107,6 +107,7 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
* @param nb_channels the number of channels * @param nb_channels the number of channels
* @param nb_samples the number of samples in a single channel * @param nb_samples the number of samples in a single channel
* @param sample_fmt the sample format * @param sample_fmt the sample format
* @param align buffer size alignment (0 = default, 1 = no alignment)
* @return required buffer size, or negative error code on failure * @return required buffer size, or negative error code on failure
*/ */
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
@@ -130,7 +131,7 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
* @param nb_channels the number of channels * @param nb_channels the number of channels
* @param nb_samples the number of samples in a single channel * @param nb_samples the number of samples in a single channel
* @param sample_fmt the sample format * @param sample_fmt the sample format
* @param align buffer size alignment (1 = no alignment required) * @param align buffer size alignment (0 = default, 1 = no alignment)
* @return 0 on success or a negative error code on failure * @return 0 on success or a negative error code on failure
*/ */
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf,
@@ -146,7 +147,7 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf,
* @param[out] linesize aligned size for audio buffer(s) * @param[out] linesize aligned size for audio buffer(s)
* @param nb_channels number of audio channels * @param nb_channels number of audio channels
* @param nb_samples number of samples per channel * @param nb_samples number of samples per channel
* @param align buffer size alignment (1 = no alignment required) * @param align buffer size alignment (0 = default, 1 = no alignment)
* @return 0 on success or a negative error code on failure * @return 0 on success or a negative error code on failure
* @see av_samples_fill_arrays() * @see av_samples_fill_arrays()
*/ */