summaryrefslogtreecommitdiff
path: root/tests/api
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-01-27 11:43:03 +0100
committerAnton Khirnov <anton@khirnov.net>2021-03-08 09:29:50 +0100
commitba30fd6c81261c0896e5755a4e1440c2792e2e89 (patch)
tree1236ff82266d510c4abea68199c160cdca90bfc0 /tests/api
parent2f004b357e6709083f741c6ed0f5a82d81784ac8 (diff)
tests/api-flac-test: ensure the frame is writable before writing to it
The encoder may keep a reference to frames that were sent to it, so the caller cannot modify them without checking first.
Diffstat (limited to 'tests/api')
-rw-r--r--tests/api/api-flac-test.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c
index 3fea3258f3..7c96a4d99e 100644
--- a/tests/api/api-flac-test.c
+++ b/tests/api/api-flac-test.c
@@ -154,6 +154,10 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
enc_pkt.data = NULL;
enc_pkt.size = 0;
+ result = av_frame_make_writable(in_frame);
+ if (result < 0)
+ return result;
+
generate_raw_frame((uint16_t*)(in_frame->data[0]), i, enc_ctx->sample_rate,
enc_ctx->channels, enc_ctx->frame_size);
in_frame_bytes = in_frame->nb_samples * in_frame->channels * sizeof(uint16_t);