Michael Niedermayer
745c40a47f
avcodec/gifdec: check that the correct number of bytes was decoded
...
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f084c646637_9261_top_title_green_frog.gif
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
564ae836fb
avcodec/gifdec: print error if image is not within dimensions
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Anton Khirnov
1f3e56b6dc
gifdec: convert to bytestream2
11 years ago
Anton Khirnov
c453723ad7
gifdec: check that the image dimensions are non-zero
...
Also add an error message an return a more suitable error code
(INVALIDDATA, not EINVAL);
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
11 years ago
Anton Khirnov
8255535c5f
gifdec: stop using deprecated avcodec_set_dimensions
11 years ago
Diego Biurrun
b2bed9325d
cosmetics: Group .name and .long_name together in codec/format declarations
11 years ago
Diego Biurrun
2832ea26f3
Remove commented-out debug #define cruft
12 years ago
Michael Niedermayer
d23b8462b5
gifdec: reset previous Graphic Control Extension disposal type
...
This fixes out of array accesses.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
afdfff485b
avcodec/gifdec: Add av_log() to workaround gcc 4.2 miscompiling the code
...
It appears gcc forgets to increment the byte stream pointer at -O3
I was not able to spot a reason/excuse for it to do that. It
also disappears if the function isnt inlined.
This should fix the gif fate failures on open & free bsd
See: [FFmpeg-devel] [PATCH] gifdec: workaround old gcc 4.2 mis-compiling code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Clément Bœsch
1ec94b0f06
lavc: factorize ff_{thread_,re,}get_buffer error messages.
...
Coccinelle profile used:
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_get_buffer(ctx, f, flags)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str;
@@
-if ((r = ff_reget_buffer(ctx, f)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_reget_buffer(ctx, f)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
+ return r;
...along with some manual patches for the remaining ones.
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Michael Niedermayer
ff080346c6
gifdec: use AVFrame accessor functions
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Paul B Mahol
7003d650b0
lavc/gifdec: remove obsolete check
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
51c7af9d32
lavc/gifdec: move idx_line allocation out of gif_read_header1()
...
Now allocation is done only if av_image_check_size() passes.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
285128eedf
lavc/gifdec: do not return nonzero *got_frame if frame is not passed
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
aaebdce3d9
lavc/gifdec: simplify "!= 0" checks
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
f1412c7997
lavc/gifdec: use memcpy()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
286930d302
gifdec: check that w,h is not zero
...
Fixes out of array access
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
c10350358d
gifdec: gif_copy_img_rect: Fix end pointer
...
Fixes out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
46cb61819d
gifdec: check that the last keyframe exists and has been successfully parsed.
...
Prevents inconsistent state and null pointer dereference
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Anton Khirnov
048ffb9bb2
gifdec: return meaningful error codes.
12 years ago
Paul B Mahol
0c8943939e
gifdec: use log level that have more common sense
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Don Moir
522cb6abf2
gifdec: use transparent instead of background color index
...
Wrong code was commited in 64f4fb75c4
.
12 years ago
Don Moir
64f4fb75c4
gifdec: fix transparent background color
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Carl Eugen Hoyos
a3a22c2178
Revert "Always write all colours for animated gif files, including transparent ones."
...
It breaks some opaque samples.
This reverts commit d4fdaafdb7
.
12 years ago
Paul B Mahol
cfa530034f
gifdec: remove dead store
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Carl Eugen Hoyos
d4fdaafdb7
Always write all colours for animated gif files, including transparent ones.
...
This fixes the colour of the transparent background (as seen with ffplay),
and makes the background of some non-keyframes transparent that was
incorrectly shown as opaque for some samples.
12 years ago
Paul B Mahol
9321e93502
gifdec: fix invalid write in gif_copy_img_rect
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
c004de0b1c
gifdec: fix invalid write in giff_fill_rect
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
3fd60d8049
gifdec: port to bytestream2 API
...
While here remove ff_lzw_cur_ptr() as it become obsolete.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Anton Khirnov
df9b956751
lavc: fix decode_frame() third parameter semantics for video decoders
...
It's got_frame, not data size
12 years ago
Anton Khirnov
594d4d5df3
lavc: add a wrapper for AVCodecContext.get_buffer().
...
It will be useful in the upcoming transition to refcounted AVFrames.
12 years ago
Paul B Mahol
49435d3888
gifdec: read pixel aspect ratio
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
2152b60f39
gifdec: use av_fast_malloc()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
d56b15017a
undo file modifiers that suck in
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Vitaliy E Sugrobov
005cb97e3e
Move some definitions to header file.
...
Share them with upcoming demuxer module.
Signed-off-by: Vitaliy E Sugrobov <vsugrob@hotmail.com>
12 years ago
Vitaliy E Sugrobov
de0cb7f070
Additional checks to prevent overread.
...
Check for availability of some required amount of bytes in buffer before
reading further.
Signed-off-by: Vitaliy E Sugrobov <vsugrob@hotmail.com>
12 years ago
Vitaliy E Sugrobov
91499f4ee8
Prepare gif decoder for use in conjunction with gif demuxer.
...
Add capability of reading multiple frames instead of only first.
Implement support for different gif frame 'disposal methods'.
Add option that allows to change background color resulting from
conversion of gif with transparency to any other format which
not support it.
Also bump lavc minor version.
Signed-off-by: Vitaliy E Sugrobov <vsugrob@hotmail.com>
12 years ago
Vitaliy E Sugrobov
c5fe41c768
Add meaningful error codes and constants.
...
Replace literals with named constants in several pieces of code
like 'return -1' and 'case 0xab'.
Change the way decoder handles absence of image data in a file:
notify gif_decode_frame() caller with got_picture set to zero
instead of returning -1.
Signed-off-by: Vitaliy E Sugrobov <vsugrob@hotmail.com>
12 years ago
Michael Niedermayer
612ecfbbbb
gifdec: check ff_lzw_decode_init() return value, fix out of array reads
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Anton Khirnov
716d413c13
Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat
12 years ago
Paul B Mahol
2da5a5ce00
gifdec: return more meaningful error codes
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
f64288960b
gifdec: remove redundant "gif: " from av_dlog()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
3662f787e7
gifdec: pass avctx to av_log()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Anton Khirnov
36ef5369ee
Replace all CODEC_ID_* with AV_CODEC_ID_*
12 years ago
Martin Storsjö
00c3b67b8a
cosmetics: Align codec declarations
...
Also break some long lines, remove codec function placeholder comments
and add spaces in sample/pixel format lists.
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Mans Rullgard
3bd1162a52
gif: fix invalid signed shifts
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Anton Khirnov
ec6402b7c5
lavc: use designated initialisers for all codecs.
...
It's more readable and less prone to breakage.
14 years ago
Mans Rullgard
2912e87a6c
Replace FFmpeg with Libav in licence headers
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Reinhard Tartler
7ffe76e540
Merge libavcore into libavutil
...
Done to keep ABI compatible. Otherwise this is just silly
14 years ago