Re: mutt 1.5.8i: SIGSEGV in imap_sync_mailbox
On Friday, 24 June 2005 at 14:40, Thomas Glanzmann wrote:
> Hello,
>
> > This is consistent with the crashes one of my users have had. It's
> > pretty serious, is there noone with IMAP knowledge who can fix it?
>
> try this patch and tell me if it works for you.
>
> Thomas
> diff --git a/hash.c b/hash.c
> +++ b/hash.c
> @@ -114,8 +114,12 @@ void *hash_find_hash (const HASH * table
> void hash_delete_hash (HASH * table, int hash, const char *key, const void
> *data,
> void (*destroy) (void *))
> {
> - struct hash_elem *ptr = table->table[hash];
> - struct hash_elem **last = &table->table[hash];
> + struct hash_elem *ptr;
> + struct hash_elem **last;
> +
> +again:
> + ptr = table->table[hash];
> + last = &table->table[hash];
>
> for (; ptr; last = &ptr->next, ptr = ptr->next)
> {
> @@ -128,7 +132,7 @@ void hash_delete_hash (HASH * table, int
> *last = ptr->next;
> if (destroy) destroy (ptr->data);
> FREE (&ptr);
> - return;
> + goto again;
> }
> }
> }
this changes the semantics of hash_delete. Is it safe to do this? I
haven't audited the code myself...
> diff --git a/imap/message.c b/imap/message.c
> +++ b/imap/message.c
> @@ -314,7 +314,10 @@ int imap_read_headers (IMAP_DATA* idata,
> fclose(fp);
>
> if (ctx->msgcount > oldmsgcount)
> + {
> + mx_alloc_memory(ctx);
> mx_update_context (ctx, ctx->msgcount - oldmsgcount);
> + }
>
> return msgend;
> }
Can you explain why this is necessary? It looks like there should
already be enough memory by this point.
> @@ -469,6 +472,8 @@ int imap_fetch_message (MESSAGE *msg, CO
> hash_delete (ctx->id_hash, h->env->message_id, h, NULL);
> if (ctx->subj_hash && h->env->real_subj)
> hash_delete (ctx->subj_hash, h->env->real_subj, h, NULL);
> + if (ctx->thread_hash && h->env->message_id)
> + hash_delete (ctx->thread_hash, h->env->message_id, NULL, NULL);
> mutt_free_envelope (&h->env);
> h->env = mutt_read_rfc822_header (msg->fp, h, 0, 0);
> if (ctx->id_hash && h->env->message_id)
This is probably the important part? Do you think it should be in
mx_update_tables as well?