Skip to content
Snippets Groups Projects
Commit 69d3288a authored by Lyubomir Marinov's avatar Lyubomir Marinov
Browse files

Commits the C source code of a fix of a memory corruption in the FFmpeg JNI...

Commits the C source code of a fix of a memory corruption in the FFmpeg JNI library caused by the use of strdup instead of av_strdup.
parent 0068cad3
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,10 @@ ...@@ -47,7 +47,10 @@
</or> </or>
</condition> </condition>
<condition property="arch" value="64"> <condition property="arch" value="64">
<os arch="amd64" /> <or>
<os arch="amd64" />
<os arch="x86_64" />
</or>
</condition> </condition>
<!-- <!--
...@@ -256,25 +259,28 @@ ...@@ -256,25 +259,28 @@
<cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnffmpeg" objdir="${obj}"> <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnffmpeg" objdir="${obj}">
<!-- common compiler flags --> <!-- common compiler flags -->
<compilerarg value="-std=c99" /> <compilerarg value="-D_JNI_IMPLEMENTATION_" />
<compilerarg value="-D_XOPEN_SOURCE=600" /> <compilerarg value="-D_XOPEN_SOURCE=600" />
<compilerarg value="-Wall" /> <compilerarg value="-fPIC" />
<compilerarg value="-O2" />
<compilerarg value="-I${ffmpeg}" /> <compilerarg value="-I${ffmpeg}" />
<compilerarg value="-D_JNI_IMPLEMENTATION_" /> <compilerarg value="-m${arch}" />
<compilerarg value="-O2" />
<compilerarg value="-std=c99" />
<compilerarg value="-Wall" />
<linkerarg value="-L${ffmpeg}/libavformat" />
<linkerarg value="-L${ffmpeg}/libavcodec" /> <linkerarg value="-L${ffmpeg}/libavcodec" />
<linkerarg value="-L${ffmpeg}/libavutil" />
<linkerarg value="-L${ffmpeg}/libavfilter" /> <linkerarg value="-L${ffmpeg}/libavfilter" />
<linkerarg value="-L${ffmpeg}/libavformat" />
<linkerarg value="-L${ffmpeg}/libavutil" />
<linkerarg value="-L${ffmpeg}/libswscale" /> <linkerarg value="-L${ffmpeg}/libswscale" />
<linkerarg value="-L${x264}" />
<!-- <!--
Depending on the way that lame is built, libmp3lame.a may be in Depending on the way that lame is built, libmp3lame.a may be in
libmp3lame/ or libmp3lame/.libs/. libmp3lame/ or libmp3lame/.libs/.
--> -->
<linkerarg value="-L${lame}/libmp3lame" /> <linkerarg value="-L${lame}/libmp3lame" />
<linkerarg value="-L${lame}/libmp3lame/.libs" /> <linkerarg value="-L${lame}/libmp3lame/.libs" />
<linkerarg value="-L${x264}" />
<linkerarg value="-m${arch}" />
<!-- <!--
Static libraries MUST be at the end otherwise they will not be added to Static libraries MUST be at the end otherwise they will not be added to
the shared library. the shared library.
...@@ -284,25 +290,17 @@ ...@@ -284,25 +290,17 @@
<linkerarg value="-lavfilter" location="end" /> <linkerarg value="-lavfilter" location="end" />
<linkerarg value="-lavutil" location="end" /> <linkerarg value="-lavutil" location="end" />
<linkerarg value="-lswscale" location="end" /> <linkerarg value="-lswscale" location="end" />
<linkerarg value="-lx264" location="end" />
<linkerarg value="-lmp3lame" location="end" /> <linkerarg value="-lmp3lame" location="end" />
<linkerarg value="-lx264" location="end" />
<!-- Linux specific flags --> <!-- Linux specific flags -->
<compilerarg value="-m32" if="cross_32" unless="is.running.macos" />
<compilerarg value="-m64" if="cross_64" unless="is.running.macos" />
<compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.linux" /> <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.linux" />
<compilerarg value="-I${system.JAVA_HOME}/include/linux" if="is.running.linux" /> <compilerarg value="-I${system.JAVA_HOME}/include/linux" if="is.running.linux" />
<linkerarg value="-m32" if="cross_32" unless="is.running.macos" />
<linkerarg value="-m64" if="cross_64" unless="is.running.macos" />
<linkerarg value="-Wl,-Bsymbolic" if="is.running.linux" /> <linkerarg value="-Wl,-Bsymbolic" if="is.running.linux" />
<!-- Mac OS X specific flags --> <!-- Mac OS X specific flags -->
<compilerarg value="-mmacosx-version-min=10.5" if="is.running.macos"/> <compilerarg value="-mmacosx-version-min=10.4" if="is.running.macos"/>
<compilerarg value="-arch" if="is.running.macos" />
<compilerarg value="x86_64" if="is.running.macos" />
<compilerarg value="-arch" if="is.running.macos" />
<compilerarg value="i386" if="is.running.macos" />
<compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" if="is.running.macos" /> <compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" if="is.running.macos" />
<!-- ffmpeg/x264 libraries cannot be built as universal binaries <!-- ffmpeg/x264 libraries cannot be built as universal binaries
...@@ -317,10 +315,6 @@ ...@@ -317,10 +315,6 @@
--> -->
<linkerarg value="-o" location="end" if="is.running.macos" /> <linkerarg value="-o" location="end" if="is.running.macos" />
<linkerarg value="libjnffmpeg.jnilib" location="end" if="is.running.macos" /> <linkerarg value="libjnffmpeg.jnilib" location="end" if="is.running.macos" />
<linkerarg value="-arch" if="is.running.macos" />
<linkerarg value="i386" if="is.running.macos" />
<linkerarg value="-arch" if="is.running.macos" />
<linkerarg value="x86_64" if="is.running.macos" />
<linkerarg value="-dynamiclib" if="is.running.macos" /> <linkerarg value="-dynamiclib" if="is.running.macos" />
<linkerarg value="-Wl,-read_only_relocs,suppress" if="is.running.macos" /> <linkerarg value="-Wl,-read_only_relocs,suppress" if="is.running.macos" />
......
...@@ -396,7 +396,7 @@ Java_org_jitsi_impl_neomedia_codec_FFmpeg_avcodeccontext_1set_1rc_1eq ...@@ -396,7 +396,7 @@ Java_org_jitsi_impl_neomedia_codec_FFmpeg_avcodeccontext_1set_1rc_1eq
const char *js = (*env)->GetStringUTFChars(env, rc_eq, NULL); const char *js = (*env)->GetStringUTFChars(env, rc_eq, NULL);
if (js) { if (js) {
s = strdup(js); s = av_strdup(js);
(*env)->ReleaseStringUTFChars(env, rc_eq, js); (*env)->ReleaseStringUTFChars(env, rc_eq, js);
} else } else
s = NULL; s = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment