OSDN Git Service

better manage buffer for libstagefright_soft_mpeg4enc
authorRay Essick <essick@google.com>
Fri, 2 Jun 2017 20:07:19 +0000 (13:07 -0700)
committerRay Essick <essick@google.com>
Fri, 2 Jun 2017 20:07:19 +0000 (13:07 -0700)
commit90d2dd403bc8faa421cfc6b26930e5aa69879943
tree7968bdf14093dcd6751a73fd3f3e22065db6dae7
parent5136b7436f98b53cbca3891e0763584f1c94b442
better manage buffer for libstagefright_soft_mpeg4enc

Existing code allocated buffer, adjusted pointer to use it, and would
adjust the pointer back when it came time to free the space. The problem
was that the adjustment was based on user-supplied values and if the
user changed those values between alloc and free (which was possible),
the code ended up free()ing the wrong address.

We fix this by keeping an extra pointer -- the unmodified allocation --
which we use for the subsequent free() calls. This makes the free()
independent of any changes to values that the user provides.

Bug: 36075363
Test: ran poc against patched nyc-mr2-dev tree
Change-Id: I7013ff5883a945c4647517b2980c76a6558f23d2
media/libstagefright/codecs/m4v_h263/enc/src/mp4enc_api.cpp
media/libstagefright/codecs/m4v_h263/enc/src/mp4lib_int.h