logo       

ClamAV infinite loop: msg#00008

security.virus.clamav.devel

Subject: ClamAV infinite loop

In tracking down another problem when memory runs
out, I found an infinite loop.

In mbox.c, starting at line 1633.

for(multiparts = 0; t_line; multiparts++) {
int lines = 0;
message **m;


m = cli_realloc(messages, ((multiparts + 1) *
sizeof(message *)));
if(m == NULL)
break;
messages = m;


aMessage = messages[multiparts] = messageCreate();
if(aMessage == NULL) {
multiparts--;
continue;
}

cli_realloc() doesn't fail, so it never breaks out of the loop
from that. messageCreate(), which calls cli_calloc(), DOES fail,
so it decrements the part number and goes back to the for loop,
which increments the part number, which does the same thing it
just tried, with the same results, ad infinitum. What's supposed
to be accomplished by retrying after messageCreate()? Nothing gets
freed in the loop, so why try the calloc() again?

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise