diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-10-01 21:36:09 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-10-01 21:36:09 +0200 |
commit | f066b0aa840f5c9c95185d6da39702e1084dc2ff (patch) | |
tree | c1bcac8dc8938fe4f45ec61dad95da3880ac74b4 /src/dabplus-enc.cpp | |
parent | 08e121571ba3e16efbf2ead1d7e10075b7e00cea (diff) | |
download | fdk-aac-f066b0aa840f5c9c95185d6da39702e1084dc2ff.tar.gz fdk-aac-f066b0aa840f5c9c95185d6da39702e1084dc2ff.tar.bz2 fdk-aac-f066b0aa840f5c9c95185d6da39702e1084dc2ff.zip |
Fix crash with bitrates above 144kbps
The output buffer was not allocated big enough.
Diffstat (limited to 'src/dabplus-enc.cpp')
-rw-r--r-- | src/dabplus-enc.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp index dfca4f1..e9aea14 100644 --- a/src/dabplus-enc.cpp +++ b/src/dabplus-enc.cpp @@ -376,7 +376,7 @@ int main(int argc, char *argv[]) } if (subchannel_index < 1 || subchannel_index > 24) { - fprintf(stderr, "Bad subchannels number: %d, try other bitrate.\n", + fprintf(stderr, "Bad subchannel index: %d, must be between 1 and 24. Try other bitrate.\n", subchannel_index); return 1; } @@ -534,10 +534,10 @@ int main(int argc, char *argv[]) } int outbuf_size = subchannel_index*120; - uint8_t zmqframebuf[2048]; + uint8_t zmqframebuf[ZMQ_HEADER_SIZE + 24*120]; zmq_frame_header_t *zmq_frame_header = (zmq_frame_header_t*)zmqframebuf; - uint8_t outbuf[2048]; + uint8_t outbuf[24*120]; if(outbuf_size % 5 != 0) { fprintf(stderr, "(outbuf_size mod 5) = %d\n", outbuf_size % 5); @@ -755,6 +755,8 @@ int main(int argc, char *argv[]) zmq_frame_header->audiolevel_left = peak_left; zmq_frame_header->audiolevel_right = peak_right; + assert(ZMQ_FRAME_SIZE(zmq_frame_header) <= NUMOF(zmqframebuf)); + memcpy(ZMQ_FRAME_DATA(zmq_frame_header), outbuf, outbuf_size); |