aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/truemotion1.c
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 /libavcodec/truemotion1.c
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>
Diffstat (limited to 'libavcodec/truemotion1.c')
-rw-r--r--libavcodec/truemotion1.c25
1 files changed, 17 insertions, 8 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; \