GNOME Bugzilla – Bug 730376
camel: Avoid an unlikely division by zero failure
Last modified: 2015-05-11 23:07:52 UTC
Patch attached.
Created attachment 276775 [details] [review] camel: Avoid an unlikely division by zero failure Coverity issue: #1061270
Created attachment 276776 [details] [review] camel: Avoid an unlikely division by zero on a race condition This is a subtle and really unlikely TOCTTOU race which Coverity found. Fix the potential division by zero which results from it. Coverity issue: #1061271
Review of attachment 276775 [details] [review]: Does this change really help Covscan to be happy with it? As goffset is signed and the function can eventually return -1, then you get division by 0 too. There might be some size = 1; of 'else' of the fstat() call, thus the added MAX will always make it >0.
Review of attachment 276776 [details] [review]: This one if fine. Feel free to commit. Thanks.
Comment on attachment 276776 [details] [review] camel: Avoid an unlikely division by zero on a race condition Attachment 276776 [details] pushed as 8fb4543 - camel: Avoid an unlikely division by zero on a race condition
Created attachment 276840 [details] [review] camel: Avoid an unlikely division by zero failure Coverity issue: #1061270
Review of attachment 276840 [details] [review]: Looks fine, please commit. Thanks.
Attachment 276840 [details] pushed as d8685b1 - camel: Avoid an unlikely division by zero failure
Created attachment 303177 [details] [review] camel: Avoid an unlikely division by zero on a race condition This is a subtle and really unlikely TOCTTOU race which Coverity found. Fix the potential division by zero which results from it. This fixes another instance of the original problem, fixed in commit 8fb4543. Coverity issue: #1061271
(In reply to Philip Withnall from comment #9) > Created attachment 303177 [details] [review] [review] > camel: Avoid an unlikely division by zero on a race condition > > This is a subtle and really unlikely TOCTTOU race which Coverity found. > Fix the potential division by zero which results from it. > > This fixes another instance of the original problem, fixed in commit > 8fb4543. > > Coverity issue: #1061271 This patch fixes another instance of the same problem, in a different place in camel-maildir-summary.c, which I should have fixed the same time round. Attaching the patch here because it stems from the same Coverity issue (CID: #1061271).
Review of attachment 303177 [details] [review]: Looks fine, feel free to commit it. I left up to you whether only to master or also to gnome-3-16.
Attachment 303177 [details] pushed as cc95f45 - camel: Avoid an unlikely division by zero on a race condition
(In reply to Milan Crha from comment #11) > Review of attachment 303177 [details] [review] [review]: > > Looks fine, feel free to commit it. I left up to you whether only to master > or also to gnome-3-16. Just pushed to master. It's not worth touching gnome-3-16 for this, since it's a very unlikely race to hit.