summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-08 14:58:56 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-08 14:58:56 +0100
commit57cee850238488a6088085ae078af17f04f2198a (patch)
tree9551a690983609d59e91e3c63ae4b15114eecb34 /libavcodec
parent7efee140d7d6fe197a73a178314eacd330a8cc77 (diff)
parent096abfa15052977eed93f0b5e01afd2d47c53c1f (diff)
Merge commit '096abfa15052977eed93f0b5e01afd2d47c53c1f'
* commit '096abfa15052977eed93f0b5e01afd2d47c53c1f': parser: fix large overreads bitstream: add get_bits64() to support reading more than 32 bits at once arm: detect cpu features at runtime on Linux Conflicts: libavcodec/parser.c libavformat/mpegts.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/get_bits.h10
-rw-r--r--libavcodec/parser.c5
2 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 965d69c061..777176dd30 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -322,15 +322,15 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n)
*/
static inline uint64_t get_bits64(GetBitContext *s, int n)
{
- if (n <= 32)
+ if (n <= 32) {
return get_bits_long(s, n);
- else {
+ } else {
#ifdef BITSTREAM_READER_LE
uint64_t ret = get_bits_long(s, 32);
- return ret | (((uint64_t)get_bits_long(s, n-32)) << 32);
+ return ret | (uint64_t)get_bits_long(s, n - 32) << 32;
#else
- uint64_t ret = ((uint64_t)get_bits_long(s, 32)) << (n-32);
- return ret | get_bits_long(s, n-32);
+ uint64_t ret = (uint64_t)get_bits_long(s, n - 32) << 32;
+ return ret | get_bits_long(s, 32);
#endif
}
}
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 2e204e2c2a..3b4715035a 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -253,8 +253,9 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
if(!new_buffer)
return AVERROR(ENOMEM);
pc->buffer = new_buffer;
- if(FF_INPUT_BUFFER_PADDING_SIZE > -next)
- memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE );
+ if (next > -FF_INPUT_BUFFER_PADDING_SIZE)
+ memcpy(&pc->buffer[pc->index], *buf,
+ next + FF_INPUT_BUFFER_PADDING_SIZE);
pc->index = 0;
*buf= pc->buffer;
}