summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-04-08 11:34:15 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-04-08 11:34:15 +0000
commit87e8788680e16c51f6048af26f3f7830c35207a5 (patch)
treefa9a92796c9981383e81a1729fa191548c88ea0f
parentf118d254bed53d8cadaedbb295c06639dc0f76aa (diff)
allocate 32 extra bytes at the end of the probe buffer and remove most probe buf_size checks
Originally committed as revision 8677 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/4xm.c3
-rw-r--r--libavformat/aiff.c2
-rw-r--r--libavformat/amr.c2
-rw-r--r--libavformat/apc.c3
-rw-r--r--libavformat/asf.c3
-rw-r--r--libavformat/au.c2
-rw-r--r--libavformat/avformat.h5
-rw-r--r--libavformat/avidec.c2
-rw-r--r--libavformat/avs.c2
-rw-r--r--libavformat/bethsoftvid.c2
-rw-r--r--libavformat/c93.c3
-rw-r--r--libavformat/dsicin.c3
-rw-r--r--libavformat/dxa.c2
-rw-r--r--libavformat/electronicarts.c3
-rw-r--r--libavformat/ffm.c2
-rw-r--r--libavformat/flic.c3
-rw-r--r--libavformat/flvdec.c2
-rw-r--r--libavformat/gxf.c2
-rw-r--r--libavformat/idcin.c4
-rw-r--r--libavformat/idroq.c3
-rw-r--r--libavformat/ipmovie.c2
-rw-r--r--libavformat/libnut.c2
-rw-r--r--libavformat/matroska.c3
-rw-r--r--libavformat/mm.c2
-rw-r--r--libavformat/mmf.c2
-rw-r--r--libavformat/mov.c2
-rw-r--r--libavformat/mp3.c3
-rw-r--r--libavformat/mpc.c2
-rw-r--r--libavformat/mpeg.c2
-rw-r--r--libavformat/mtv.c3
-rw-r--r--libavformat/nsvdec.c2
-rw-r--r--libavformat/nuv.c2
-rw-r--r--libavformat/ogg2.c2
-rw-r--r--libavformat/raw.c4
-rw-r--r--libavformat/rm.c2
-rw-r--r--libavformat/segafilm.c3
-rw-r--r--libavformat/sierravmd.c3
-rw-r--r--libavformat/smacker.c2
-rw-r--r--libavformat/sol.c2
-rw-r--r--libavformat/swf.c2
-rw-r--r--libavformat/thp.c3
-rw-r--r--libavformat/tta.c2
-rw-r--r--libavformat/utils.c2
-rw-r--r--libavformat/vocdec.c2
-rw-r--r--libavformat/yuv4mpeg.c2
45 files changed, 7 insertions, 104 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index bf10b9e820..e3e3a9f799 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -79,9 +79,6 @@ typedef struct FourxmDemuxContext {
static int fourxm_probe(AVProbeData *p)
{
- if (p->buf_size < 12)
- return 0;
-
if ((AV_RL32(&p->buf[0]) != RIFF_TAG) ||
(AV_RL32(&p->buf[8]) != _4XMV_TAG))
return 0;
diff --git a/libavformat/aiff.c b/libavformat/aiff.c
index 868d552192..74ff14a14f 100644
--- a/libavformat/aiff.c
+++ b/libavformat/aiff.c
@@ -275,8 +275,6 @@ static int aiff_write_trailer(AVFormatContext *s)
static int aiff_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size < 16)
- return 0;
if (p->buf[0] == 'F' && p->buf[1] == 'O' &&
p->buf[2] == 'R' && p->buf[3] == 'M' &&
p->buf[8] == 'A' && p->buf[9] == 'I' &&
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 635a898fa7..98fd35a08c 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -73,8 +73,6 @@ static int amr_probe(AVProbeData *p)
//This will also trigger multichannel files: "#!AMR_MC1.0\n" and
//"#!AMR-WB_MC1.0\n" (not supported)
- if (p->buf_size < 5)
- return 0;
if(memcmp(p->buf,AMR_header,5)==0)
return AVPROBE_SCORE_MAX;
else
diff --git a/libavformat/apc.c b/libavformat/apc.c
index a937b1d8d7..94ee28072e 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -24,9 +24,6 @@
static int apc_probe(AVProbeData *p)
{
- if (p->buf_size < 8)
- return 0;
-
if (!strncmp(p->buf, "CRYO_APC", 8))
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 498f6e79ea..5c67b7f259 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -119,9 +119,6 @@ static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size)
static int asf_probe(AVProbeData *pd)
{
/* check file header */
- if (pd->buf_size <= 32)
- return 0;
-
if (!memcmp(pd->buf, &asf_header, sizeof(GUID)))
return AVPROBE_SCORE_MAX;
else
diff --git a/libavformat/au.c b/libavformat/au.c
index 9e84c9d313..aaa97c76fa 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -103,8 +103,6 @@ static int au_write_trailer(AVFormatContext *s)
static int au_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 24)
- return 0;
if (p->buf[0] == '.' && p->buf[1] == 's' &&
p->buf[2] == 'n' && p->buf[3] == 'd')
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1d811f324f..c5d5df0197 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -25,8 +25,8 @@
extern "C" {
#endif
-#define LIBAVFORMAT_VERSION_INT ((51<<16)+(11<<8)+0)
-#define LIBAVFORMAT_VERSION 51.11.0
+#define LIBAVFORMAT_VERSION_INT ((51<<16)+(12<<8)+0)
+#define LIBAVFORMAT_VERSION 51.12.0
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
@@ -132,6 +132,7 @@ typedef struct AVProbeData {
} AVProbeData;
#define AVPROBE_SCORE_MAX 100 ///< max score, half of that is used for file extension based detection
+#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer
typedef struct AVFormatParameters {
AVRational time_base;
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 23c130ab7e..02078bc77b 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -995,8 +995,6 @@ static int avi_read_close(AVFormatContext *s)
static int avi_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 32)
- return 0;
if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
p->buf[2] == 'F' && p->buf[3] == 'F' &&
p->buf[8] == 'A' && p->buf[9] == 'V' &&
diff --git a/libavformat/avs.c b/libavformat/avs.c
index 0fa77defff..5325ff6610 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -47,8 +47,6 @@ static int avs_probe(AVProbeData * p)
{
const uint8_t *d;
- if (p->buf_size < 2)
- return 0;
d = p->buf;
if (d[0] == 'w' && d[1] == 'W' && d[2] == 0x10 && d[3] == 0)
return 50;
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 91fecb5841..0e73804f43 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -49,7 +49,7 @@ typedef struct BVID_DemuxContext
static int vid_probe(AVProbeData *p)
{
// little endian VID tag, file starts with "VID\0"
- if (p->buf_size < 4 || AV_RL32(p->buf) != MKTAG('V', 'I', 'D', 0))
+ if (AV_RL32(p->buf) != MKTAG('V', 'I', 'D', 0))
return 0;
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/c93.c b/libavformat/c93.c
index 89838d5398..636f3e0de7 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -44,9 +44,6 @@ typedef struct {
static int probe(AVProbeData *p)
{
- if (p->buf_size < 13)
- return 0;
-
if (p->buf[0] == 0x01 && p->buf[1] == 0x00 &&
p->buf[4] == 0x01 + p->buf[2] &&
p->buf[8] == p->buf[4] + p->buf[6] &&
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index fb9cb50dfe..61e5e39a3a 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -58,9 +58,6 @@ typedef struct CinDemuxContext {
static int cin_probe(AVProbeData *p)
{
- if (p->buf_size < 18)
- return 0;
-
/* header starts with this special marker */
if (AV_RL32(&p->buf[0]) != 0x55AA0000)
return 0;
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index f49d3d4acf..81dbd2e713 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -36,8 +36,6 @@ typedef struct{
static int dxa_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 4)
- return 0;
if (p->buf[0] == 'D' && p->buf[1] == 'E' &&
p->buf[2] == 'X' && p->buf[3] == 'A')
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 762d658ab1..e140d494bb 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -165,9 +165,6 @@ static int process_ea_header(AVFormatContext *s) {
static int ea_probe(AVProbeData *p)
{
- if (p->buf_size < 4)
- return 0;
-
if (AV_RL32(&p->buf[0]) != SCHl_TAG)
return 0;
diff --git a/libavformat/ffm.c b/libavformat/ffm.c
index a2970ae423..22cdaf3091 100644
--- a/libavformat/ffm.c
+++ b/libavformat/ffm.c
@@ -758,7 +758,7 @@ static int ffm_read_close(AVFormatContext *s)
static int ffm_probe(AVProbeData *p)
{
- if (p->buf_size >= 4 &&
+ if (
p->buf[0] == 'F' && p->buf[1] == 'F' && p->buf[2] == 'M' &&
p->buf[3] == '1')
return AVPROBE_SCORE_MAX + 1;
diff --git a/libavformat/flic.c b/libavformat/flic.c
index 0c3a7f01f9..d5544b5e0a 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -55,9 +55,6 @@ static int flic_probe(AVProbeData *p)
{
int magic_number;
- if (p->buf_size < 6)
- return 0;
-
magic_number = AV_RL16(&p->buf[4]);
if ((magic_number != FLIC_FILE_MAGIC_1) &&
(magic_number != FLIC_FILE_MAGIC_2) &&
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index bf91fbbc78..3278cdcff8 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -31,8 +31,6 @@ static int flv_probe(AVProbeData *p)
{
const uint8_t *d;
- if (p->buf_size < 6)
- return 0;
d = p->buf;
if (d[0] == 'F' && d[1] == 'L' && d[2] == 'V' && d[3] < 5 && d[5]==0) {
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index ba2463eadf..a4a933c184 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -87,8 +87,6 @@ static int parse_packet_header(ByteIOContext *pb, pkt_type_t *type, int *length)
static int gxf_probe(AVProbeData *p) {
static const uint8_t startcode[] = {0, 0, 0, 0, 1, 0xbc}; // start with map packet
static const uint8_t endcode[] = {0, 0, 0, 0, 0xe1, 0xe2};
- if (p->buf_size < 16)
- return 0;
if (!memcmp(p->buf, startcode, sizeof(startcode)) &&
!memcmp(&p->buf[16 - sizeof(endcode)], endcode, sizeof(endcode)))
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index e2c92f3b45..f0f4427008 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -104,10 +104,6 @@ static int idcin_probe(AVProbeData *p)
* audio channels: 0 for no audio, or 1 or 2
*/
- /* cannot proceed without 20 bytes */
- if (p->buf_size < 20)
- return 0;
-
/* check the video width */
number = AV_RL32(&p->buf[0]);
if ((number == 0) || (number > 1024))
diff --git a/libavformat/idroq.c b/libavformat/idroq.c
index b8ee176ab9..ddda86fec8 100644
--- a/libavformat/idroq.c
+++ b/libavformat/idroq.c
@@ -58,9 +58,6 @@ typedef struct RoqDemuxContext {
static int roq_probe(AVProbeData *p)
{
- if (p->buf_size < 6)
- return 0;
-
if ((AV_RL16(&p->buf[0]) != RoQ_MAGIC_NUMBER) ||
(AV_RL32(&p->buf[2]) != 0xFFFFFFFF))
return 0;
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 975bfd36ba..06585dfb6a 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -507,8 +507,6 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
static int ipmovie_probe(AVProbeData *p)
{
- if (p->buf_size < IPMOVIE_SIGNATURE_SIZE)
- return 0;
if (strncmp(p->buf, IPMOVIE_SIGNATURE, IPMOVIE_SIGNATURE_SIZE) != 0)
return 0;
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 0f7b879a94..b29df8e876 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -166,7 +166,7 @@ AVOutputFormat libnut_muxer = {
#endif //CONFIG_MUXERS
static int nut_probe(AVProbeData *p) {
- if (p->buf_size >= ID_LENGTH && !memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
+ if (!memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
return 0;
}
diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 591530490c..414342288a 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -1074,9 +1074,6 @@ matroska_probe (AVProbeData *p)
int len_mask = 0x80, size = 1, n = 1;
uint8_t probe_data[] = { 'm', 'a', 't', 'r', 'o', 's', 'k', 'a' };
- if (p->buf_size < 5)
- return 0;
-
/* ebml header? */
if ((p->buf[0] << 24 | p->buf[1] << 16 |
p->buf[2] << 8 | p->buf[3]) != EBML_ID_HEADER)
diff --git a/libavformat/mm.c b/libavformat/mm.c
index 443b709294..a7a67e9f00 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -59,8 +59,6 @@ typedef struct {
static int mm_probe(AVProbeData *p)
{
/* the first chunk is always the header */
- if (p->buf_size < MM_PREAMBLE_SIZE)
- return 0;
if (AV_RL16(&p->buf[0]) != MM_TYPE_HEADER)
return 0;
if (AV_RL32(&p->buf[2]) != MM_HEADER_LEN_V && AV_RL32(&p->buf[2]) != MM_HEADER_LEN_AV)
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 40b1a497cc..e395587002 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -168,8 +168,6 @@ static int mmf_write_trailer(AVFormatContext *s)
static int mmf_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 32)
- return 0;
if (p->buf[0] == 'M' && p->buf[1] == 'M' &&
p->buf[2] == 'M' && p->buf[3] == 'D' &&
p->buf[8] == 'C' && p->buf[9] == 'N' &&
diff --git a/libavformat/mov.c b/libavformat/mov.c
index e9b577576b..b138e3c523 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1320,8 +1320,6 @@ static int mov_probe(AVProbeData *p)
int score = 0;
/* check file header */
- if (p->buf_size <= 12)
- return 0;
offset = 0;
for(;;) {
/* ignore invalid offset */
diff --git a/libavformat/mp3.c b/libavformat/mp3.c
index e86ea14c80..60066a7797 100644
--- a/libavformat/mp3.c
+++ b/libavformat/mp3.c
@@ -252,9 +252,6 @@ static int mp3_read_probe(AVProbeData *p)
uint8_t *buf, *buf2, *end;
AVCodecContext avctx;
- if(p->buf_size < ID3_HEADER_SIZE)
- return 0;
-
if(id3_match(p->buf))
return AVPROBE_SCORE_MAX/2+1; // this must be less then mpeg-ps because some retards put id3 tage before mpeg-ps files
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index a28efb16d7..5e75f16334 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -42,8 +42,6 @@ typedef struct {
static int mpc_probe(AVProbeData *p)
{
const uint8_t *d = p->buf;
- if (p->buf_size < 32)
- return 0;
if (d[0] == 'M' && d[1] == 'P' && d[2] == '+' && (d[3] == 0x17 || d[3] == 0x7))
return AVPROBE_SCORE_MAX;
if (d[0] == 'I' && d[1] == 'D' && d[2] == '3')
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index ae47fa60ac..40a7a259f2 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -1260,8 +1260,6 @@ static int mpeg_mux_end(AVFormatContext *ctx)
static int cdxa_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 32)
- return 0;
if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
p->buf[2] == 'F' && p->buf[3] == 'F' &&
p->buf[8] == 'C' && p->buf[9] == 'D' &&
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index 55800867e8..88a077ccd8 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -54,9 +54,6 @@ typedef struct MTVDemuxContext {
static int mtv_probe(AVProbeData *p)
{
- if(p->buf_size < 3)
- return 0;
-
/* Magic is 'AMV' */
if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V')
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 2753edbd99..988dab21df 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -728,8 +728,6 @@ static int nsv_probe(AVProbeData *p)
int i;
// PRINT(("nsv_probe(), buf_size %d\n", p->buf_size));
/* check file header */
- if (p->buf_size <= 32)
- return 0;
if (p->buf[0] == 'N' && p->buf[1] == 'S' &&
p->buf[2] == 'V' && p->buf[3] == 'f')
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 7e04222eea..feb1d3060a 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -35,8 +35,6 @@ typedef enum {
} frametype_t;
static int nuv_probe(AVProbeData *p) {
- if (p->buf_size < 12)
- return 0;
if (!memcmp(p->buf, "NuppelVideo", 12))
return AVPROBE_SCORE_MAX;
if (!memcmp(p->buf, "MythTVVideo", 12))
diff --git a/libavformat/ogg2.c b/libavformat/ogg2.c
index 8ca7b2d136..a3739556e4 100644
--- a/libavformat/ogg2.c
+++ b/libavformat/ogg2.c
@@ -676,8 +676,6 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
static int ogg_probe(AVProbeData *p)
{
- if (p->buf_size < 6)
- return 0;
if (p->buf[0] == 'O' && p->buf[1] == 'g' &&
p->buf[2] == 'g' && p->buf[3] == 'S' &&
p->buf[4] == 0x0 && p->buf[5] <= 0x7 )
diff --git a/libavformat/raw.c b/libavformat/raw.c
index 73a20379ae..32b439b016 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -382,8 +382,6 @@ static int h263_probe(AVProbeData *p)
int code;
const uint8_t *d;
- if (p->buf_size < 6)
- return 0;
d = p->buf;
code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2);
if (code == 0x20) {
@@ -397,8 +395,6 @@ static int h261_probe(AVProbeData *p)
int code;
const uint8_t *d;
- if (p->buf_size < 6)
- return 0;
d = p->buf;
code = (d[0] << 12) | (d[1] << 4) | (d[2] >> 4);
if (code == 0x10) {
diff --git a/libavformat/rm.c b/libavformat/rm.c
index ad2f5ff27c..d2e41acbb6 100644
--- a/libavformat/rm.c
+++ b/libavformat/rm.c
@@ -1063,8 +1063,6 @@ static int rm_read_close(AVFormatContext *s)
static int rm_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 32)
- return 0;
if ((p->buf[0] == '.' && p->buf[1] == 'R' &&
p->buf[2] == 'M' && p->buf[3] == 'F' &&
p->buf[4] == 0 && p->buf[5] == 0) ||
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index b5375ccf73..5990047f0b 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -66,9 +66,6 @@ typedef struct FilmDemuxContext {
static int film_probe(AVProbeData *p)
{
- if (p->buf_size < 4)
- return 0;
-
if (AV_RB32(&p->buf[0]) != FILM_TAG)
return 0;
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index 3e1c8597db..eba0bbb9e3 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -59,9 +59,6 @@ typedef struct VmdDemuxContext {
static int vmd_probe(AVProbeData *p)
{
- if (p->buf_size < 2)
- return 0;
-
/* check if the first 2 bytes of the file contain the appropriate size
* of a VMD header chunk */
if (AV_RL16(&p->buf[0]) != VMD_HEADER_SIZE - 2)
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 04fde3d037..7a784c7d4c 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -88,8 +88,6 @@ static const uint8_t smk_pal[64] = {
static int smacker_probe(AVProbeData *p)
{
- if (p->buf_size < 4)
- return 0;
if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K'
&& (p->buf[3] == '2' || p->buf[3] == '4'))
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/sol.c b/libavformat/sol.c
index 951ec6eb9a..6ab70eef04 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -35,8 +35,6 @@ static int sol_probe(AVProbeData *p)
{
/* check file header */
uint16_t magic;
- if (p->buf_size <= 14)
- return 0;
magic=le2me_16(*((uint16_t*)p->buf));
if ((magic == 0x0B8D || magic == 0x0C0D || magic == 0x0C8D) &&
p->buf[2] == 'S' && p->buf[3] == 'O' &&
diff --git a/libavformat/swf.c b/libavformat/swf.c
index 7d889af7d0..f8f21462a3 100644
--- a/libavformat/swf.c
+++ b/libavformat/swf.c
@@ -618,8 +618,6 @@ static int get_swf_tag(ByteIOContext *pb, int *len_ptr)
static int swf_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size <= 16)
- return 0;
if ((p->buf[0] == 'F' || p->buf[0] == 'C') && p->buf[1] == 'W' &&
p->buf[2] == 'S')
return AVPROBE_SCORE_MAX;
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 1b7567e78e..f0fcfa9f5e 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -47,9 +47,6 @@ typedef struct ThpDemuxContext {
static int thp_probe(AVProbeData *p)
{
/* check file header */
- if (p->buf_size < 4)
- return 0;
-
if (AV_RL32(p->buf) == MKTAG('T', 'H', 'P', '\0'))
return AVPROBE_SCORE_MAX;
else
diff --git a/libavformat/tta.c b/libavformat/tta.c
index a3709437ee..821d6ab9c5 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -29,8 +29,6 @@ typedef struct {
static int tta_probe(AVProbeData *p)
{
const uint8_t *d = p->buf;
- if (p->buf_size < 4)
- return 0;
if (d[0] == 'T' && d[1] == 'T' && d[2] == 'A' && d[3] == '1')
return 80;
return 0;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d062948b4c..dec67fa847 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -429,7 +429,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){
int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0;
/* read probe data */
- pd->buf= av_realloc(pd->buf, probe_size);
+ pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE);
pd->buf_size = get_buffer(pb, pd->buf, probe_size);
if (url_fseek(pb, 0, SEEK_SET) < 0) {
url_fclose(pb);
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index 85d304dff8..c91baa6db9 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -28,8 +28,6 @@ static int voc_probe(AVProbeData *p)
{
int version, check;
- if (p->buf_size < 26)
- return 0;
if (memcmp(p->buf, voc_magic, sizeof(voc_magic) - 1))
return 0;
version = p->buf[22] | (p->buf[23] << 8);
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index 70214ae00f..a0a6ba3457 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -386,8 +386,6 @@ static int yuv4_read_close(AVFormatContext *s)
static int yuv4_probe(AVProbeData *pd)
{
/* check file header */
- if (pd->buf_size <= sizeof(Y4M_MAGIC))
- return 0;
if (strncmp(pd->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1)==0)
return AVPROBE_SCORE_MAX;
else