akorentlab / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

stringFindSubstr() in utils.c doesn't properly handle NULL ploc argument #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. pass NULL ploc argument to stringFindSubstr().

What is the expected output? What do you see instead?
I expect the ploc argument to be optional.
Instead program crashes.

What version of the product are you using? On what operating system?
leptonlib-1.63.
Microsoft Visual Studio 2008 SP1 with latest updates also applied.
Windows XP Pro SP3.

Please provide any additional information below.
utils.c line 948 should be changed from:

    if (*ploc)

to:

    if (ploc)

Original issue reported on code.google.com by tomp2...@gmail.com on 1 Dec 2009 at 11:45

GoogleCodeExporter commented 9 years ago
Exactly.  Dereferencing a null ptr!  Thanks for finding this careless mistake.

Original comment by dan.bloo...@gmail.com on 1 Dec 2009 at 6:33