zengxiange / tesseract-android-tools

Automatically exported from code.google.com/p/tesseract-android-tools
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 jaypmuel...@gmail.com on 4 Sep 2013 at 6:06

GoogleCodeExporter commented 9 years ago
Thanks very much for taking the time to post the fix.

Original comment by benba...@gmail.com on 31 Jul 2014 at 2:12