aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-12 16:16:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-12 16:16:58 +0100
commitc693ccb89a9ed81b90901d958f8e72a7179c7242 (patch)
treeaf12df8e99689719d1739ec9685d38e4ad5fd205
parent7e343798976991f4320c1c90b8d4fac4c2f9e355 (diff)
parent7b337b122959b9bf634c31b549892df974f35b40 (diff)
downloadffmpeg-c693ccb89a9ed81b90901d958f8e72a7179c7242.tar.gz
Merge commit '7b337b122959b9bf634c31b549892df974f35b40' into release/1.1
* commit '7b337b122959b9bf634c31b549892df974f35b40': truemotion1: make sure index does not go out of bounds pcx: round up in bits->bytes conversion in a buffer size check omadec: Fix wrong number of array elements omadec: check GEOB sizes against buffer size ac3dec: fix outptr increment. avio: Use AVERROR_PROTOCOL_NOT_FOUND Conflicts: libavcodec/ac3dec.c libavcodec/pcx.c libavformat/omadec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/truemotion1.c25
-rw-r--r--libavformat/omadec.c5
2 files changed, 19 insertions, 11 deletions
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index e2c1d2804a..b297bd97d0 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -513,6 +513,15 @@ hres,vres,i,i%vres (0 < i < 4)
index = s->index_stream[index_stream_index++] * 4; \
}
+#define INC_INDEX \
+do { \
+ if (index >= 1023) { \
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid index value.\n"); \
+ return; \
+ } \
+ index++; \
+} while (0)
+
#define APPLY_C_PREDICTOR() \
if(index > 1023){\
av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
@@ -529,10 +538,10 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \
GET_NEXT_INDEX() \
else \
- index++; \
+ INC_INDEX; \
} \
} else \
- index++;
+ INC_INDEX;
#define APPLY_C_PREDICTOR_24() \
if(index > 1023){\
@@ -550,10 +559,10 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \
GET_NEXT_INDEX() \
else \
- index++; \
+ INC_INDEX; \
} \
} else \
- index++;
+ INC_INDEX;
#define APPLY_Y_PREDICTOR() \
@@ -572,10 +581,10 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \
GET_NEXT_INDEX() \
else \
- index++; \
+ INC_INDEX; \
} \
} else \
- index++;
+ INC_INDEX;
#define APPLY_Y_PREDICTOR_24() \
if(index > 1023){\
@@ -593,10 +602,10 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \
GET_NEXT_INDEX() \
else \
- index++; \
+ INC_INDEX; \
} \
} else \
- index++;
+ INC_INDEX;
#define OUTPUT_PIXEL_PAIR() \
*current_pixel_pair = *vert_pred + horiz_pred; \
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index 50a5f955ca..5263bc4d5d 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -233,9 +233,8 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
av_log(s, AV_LOG_ERROR, "Invalid encryption header\n");
return -1;
}
- if ( OMA_ENC_HEADER_SIZE + oc->k_size + oc->e_size + oc->i_size + 8 > geob->datasize
- || OMA_ENC_HEADER_SIZE + 48 > geob->datasize
- ) {
+ if (OMA_ENC_HEADER_SIZE + oc->k_size + oc->e_size + oc->i_size + 8 > geob->datasize ||
+ OMA_ENC_HEADER_SIZE + 48 > geob->datasize) {
av_log(s, AV_LOG_ERROR, "Too little GEOB data\n");
return AVERROR_INVALIDDATA;
}