tesseract-android-tools icon indicating copy to clipboard operation
tesseract-android-tools copied to clipboard

ndk-build failure due to unsafe fprintf usage in tesseract source.

Open GoogleCodeExporter opened this issue 9 years ago • 1 comments

What steps will reproduce the problem?
1. Using android-ndk-r9 and the tesseract source code v3.02
2. ndk-build.cmd -j8
3.

What is the expected output? What do you see instead?

Expected successful build.  Build fails, error:

jni/com_googlecode_tesseract_android/src/dict/permdawg.cpp:208:62:      error: 
format not a string literal and no format arguments [-Werror=format-security]
cc1plus.exe: some warnings being treated as errors

Please provide any additional information below.

I fixed this by changing the line mentioned above:

jni/com_googlecode_tesseract_android/src/dict/permdawg.cpp:208:62

from:

    fprintf(output_ambig_words_file_, word_str.string());

to:

    fprintf(output_ambig_words_file_, "%s", word_str.string());

Simple enough.


Original issue reported on code.google.com by [email protected] on 4 Sep 2013 at 6:06

GoogleCodeExporter avatar Mar 08 '15 08:03 GoogleCodeExporter

Thanks very much for taking the time to post the fix.

Original comment by [email protected] on 31 Jul 2014 at 2:12

GoogleCodeExporter avatar Mar 08 '15 08:03 GoogleCodeExporter