aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Avison <bavison@riscosopen.org>2013-08-07 23:22:38 +0100
committerMartin Storsjö <martin@martin.st>2013-08-08 11:09:00 +0300
commit5afe1d27912be9b643ffb4ddc21f6d920260dbb0 (patch)
tree4188a4cbcecdec1af0f534d06e55fef14dab3a4c
parent0f1fb6c0194c85483dedb93b20a5b76f6fc9d520 (diff)
downloadffmpeg-5afe1d27912be9b643ffb4ddc21f6d920260dbb0.tar.gz
avio: Add const qualifiers to ffio_read_indirect
This provides at least some protection against potential accidental corruption of AVIO buffer workspace. Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/avio_internal.h2
-rw-r--r--libavformat/aviobuf.c2
-rw-r--r--libavformat/mpegts.c8
3 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 4fa3adb270..5493163221 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -52,7 +52,7 @@ int ffio_init_context(AVIOContext *s,
* will be a copy of buf
* @return number of bytes read or AVERROR
*/
-int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, unsigned char **data);
+int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data);
/**
* Read size bytes from AVIOContext into buf.
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 07aa88068f..2354f47fd2 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -490,7 +490,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
return size1 - size;
}
-int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, unsigned char **data)
+int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data)
{
if (s->buf_end - s->buf_ptr >= size && !s->write_flag) {
*data = s->buf_ptr;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index eecf246b3e..ba41f7fbd9 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1757,7 +1757,7 @@ static int mpegts_resync(AVFormatContext *s)
}
/* return -1 if error or EOF. Return 0 if OK. */
-static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, uint8_t **data)
+static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, const uint8_t **data)
{
AVIOContext *pb = s->pb;
int len;
@@ -1793,7 +1793,7 @@ static int handle_packets(MpegTSContext *ts, int nb_packets)
{
AVFormatContext *s = ts->stream;
uint8_t packet[TS_PACKET_SIZE+FF_INPUT_BUFFER_PADDING_SIZE];
- uint8_t *data;
+ const uint8_t *data;
int packet_num, ret = 0;
if (avio_tell(s->pb) != ts->last_pos) {
@@ -1930,7 +1930,7 @@ static int mpegts_read_header(AVFormatContext *s)
int64_t pcrs[2], pcr_h;
int packet_count[2];
uint8_t packet[TS_PACKET_SIZE];
- uint8_t *data;
+ const uint8_t *data;
/* only read packets */
@@ -1992,7 +1992,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
int64_t pcr_h, next_pcr_h, pos;
int pcr_l, next_pcr_l;
uint8_t pcr_buf[12];
- uint8_t *data;
+ const uint8_t *data;
if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
return AVERROR(ENOMEM);