aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/adts_parser.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-09 15:09:41 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-20 11:48:03 +0200
commit6c812a80ddfadb3e69018971a2e92ace5326db36 (patch)
tree30198bcf97c9324ff250e68439cd428d6c750601 /libavcodec/adts_parser.c
parent127ded507828a1127b0196ffde115171ab5c46f3 (diff)
downloadffmpeg-6c812a80ddfadb3e69018971a2e92ace5326db36.tar.gz
avcodec/adts_parser: Don't presume buffer to be padded
The documentation of av_adts_header_parse() does not require the buffer to be padded at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/adts_parser.c')
-rw-r--r--libavcodec/adts_parser.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/adts_parser.c b/libavcodec/adts_parser.c
index 6c22c86ef2..81e2669149 100644
--- a/libavcodec/adts_parser.c
+++ b/libavcodec/adts_parser.c
@@ -28,9 +28,14 @@
int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, uint8_t *frames)
{
#if CONFIG_ADTS_HEADER
+ uint8_t tmpbuf[AV_AAC_ADTS_HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
GetBitContext gb;
AACADTSHeaderInfo hdr;
- int err = init_get_bits8(&gb, buf, AV_AAC_ADTS_HEADER_SIZE);
+ int err;
+ if (!buf)
+ return AVERROR(EINVAL);
+ memcpy(tmpbuf, buf, AV_AAC_ADTS_HEADER_SIZE);
+ err = init_get_bits8(&gb, tmpbuf, AV_AAC_ADTS_HEADER_SIZE);
if (err < 0)
return err;
err = ff_adts_header_parse(&gb, &hdr);