From 17e0c1190989cd0124ed8d55dd37d1ed21d6da52 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 4 Apr 2021 11:38:05 +0200 Subject: [PATCH] AAC reader: use 64-bit integer types in file size related calculations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise files bigger than 2 GB result in negative numbers… Fixes #3059. --- NEWS.md | 2 ++ src/input/r_aac.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index c0b6f64be..a47a205d7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -63,6 +63,8 @@ * mkvmerge: HEVC/H.265: mkvextract will now normalize the placement of VPS, SPS and PPS NALUs. Each key frame is prefixed with exactly one copy of the currently active parameter sets. +* mkvmerge: AAC reader: fixed mkvmerge aborting to read AAC files bigger than + 2 GB with a message about not being able to allocate memory. Fixes #3059. ## Build system changes diff --git a/src/input/r_aac.cpp b/src/input/r_aac.cpp index c0afe7696..bbec79f1a 100644 --- a/src/input/r_aac.cpp +++ b/src/input/r_aac.cpp @@ -105,9 +105,9 @@ aac_reader_c::create_packetizer(int64_t) { file_status_e aac_reader_c::read(generic_packetizer_c *, bool) { - int remaining_bytes = m_size - m_in->getFilePointer(); - auto read_len = std::min(m_chunk->get_size(), remaining_bytes); - int num_read = m_in->read(m_chunk, read_len); + auto remaining_bytes = m_size - m_in->getFilePointer(); + auto read_len = std::min(m_chunk->get_size(), remaining_bytes); + auto num_read = m_in->read(m_chunk, read_len); if (0 < num_read) { m_parser.add_bytes(m_chunk->get_buffer(), num_read);