Hi folks,
Attached is a patch for the bug that sends mimedb into an infinite
loop for some mime files. The problem occurred when a short matching
comment tag occurs after a long matching comment tag. I fixed the loop
logic, and the bug appears to be fixed.
Since Fish seems not to be actively maintained, I've also converted
the Fish darcs repository to git, applied the mimedb patch, and
uploaded it to github. If any programmers want to make any changes to
Fish, it's now just that little bit easier to do so.
The repository is at: http://github.com/weavejester/fish
- James
diff --git a/mimedb.c b/mimedb.c
index ec2d5eb..bad9b87 100644
--- a/mimedb.c
+++ b/mimedb.c
@@ -470,7 +470,7 @@ static char *get_description( const char *mimetype )
int fd;
struct stat st;
char *contents;
- char *start=0, *stop=0;
+ char *start=0, *stop=0, *best_start=0;
if( !start_re )
{
@@ -583,6 +583,7 @@ static char *get_description( const char *mimetype )
while( !regexec(start_re, start, 1, match, 0) )
{
int new_w = match[0].rm_eo - match[0].rm_so;
+ start += match[0].rm_eo;
if( new_w > w )
{
@@ -591,12 +592,13 @@ static char *get_description( const char *mimetype )
match, so we use the new match
*/
w=new_w;
- start += match[0].rm_eo;
+ best_start = start;
}
}
if( w != -1 )
{
+ start = best_start;
if( !regexec(stop_re, start, 1, match, 0) )
{
/*
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users