Fix TOCTOU problem in libstagefright_soft_aacenc
Fixes a configuration error where we sized a buffer initially based
on the configuration at the time and held onto the buffer through the
rest of our lifetime. If the configuration was changed in a way that
resulted in needing a different size buffer, the code did not make
Patch keeps the buffer around but also stores the 'current allocation
size'. This allows the later code that preps the buffer to query if
the buffer size is same or changed. If changed, we discard the old
buffer and allocate a new one of the appropriate size.
safetynet logging added so we can tell how often this happens in the
Testing was done on nyc-mr2 (where poc was built). Patch applies
without change to k/l/m/n/master.
Test: run POC, saw new diagnostics saying it caught the size change.
(cherry picked from commit 0495c029bd51bcfc1cca8c943ab4ce2f201dbe98)
2 files changed