Skip to content

Commit

Permalink
Fixes crash in disambiguate_r() when source file is empty
Browse files Browse the repository at this point in the history
Thanks to ehsan for discovering this bug.
  • Loading branch information
Robin Luckey committed Dec 15, 2011
1 parent 2bad7f9 commit 431ee2f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/detector.c
Expand Up @@ -739,6 +739,9 @@ const char *disambiguate_pro(SourceFile *sourcefile) {

const char *disambiguate_r(SourceFile *sourcefile) {
char *contents = ohcount_sourcefile_get_contents(sourcefile);
if (!contents)
return LANG_R;

char *eof = contents + ohcount_sourcefile_get_contents_size(sourcefile);

// Detect REBOL by looking for the occurence of "rebol" in the contents
Expand Down

0 comments on commit 431ee2f

Please sign in to comment.