#20 dump.c segfault on long lines for alphabets[]

closed-accepted
nobody
None
5
2012-08-05
2012-08-04
Jose Da Silva
No

Patch to prevent segfault and exit with an error code and error message if a line is too long for any of the input files loaded by dump.c in the file list *alphabets[]

To test, substitute TestLine.txt for 8859-1.TXT and the program should stop gracefully.
To test memory released okay, restore 8859-1.TXT and substitute TestLine.txt for any file listed after 8859-1.txt, such as 8859-2.TXT

gcc -o dump dump.c
valgrind ./dump
results, no segfault, and error message produced.

Discussion

  • Jose Da Silva
    Jose Da Silva
    2012-08-04

    alphabets[] segfault prevention

     
    Attachments
  • Jose Da Silva
    Jose Da Silva
    2012-08-04

    TestLine.txt (comment file with long lines in it

     
    Attachments
    • status: open --> closed-accepted
     
  • Thanks, applied.