Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Issue 10831337: Prevent crashes in mime_util_xdg. (Closed)

Created:
8 years, 4 months ago by benjhayden
Modified:
8 years, 4 months ago
Reviewers:
Lei Zhang, brettw
CC:
chromium-reviews, erikwright+watch_chromium.org, brettw-cc_chromium.org, Randy Smith (Not in Mondays)
Visibility:
Public.

Description

Prevent crashes in mime_util_xdg. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=152347

Patch Set 1 #

Total comments: 4

Patch Set 2 : . #

Patch Set 3 : merge #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -1 line) Patch
M base/nix/mime_util_xdg.cc View 1 2 chunks +3 lines, -1 line 2 comments Download

Messages

Total messages: 10 (0 generated)
benjhayden
PTAL
8 years, 4 months ago (2012-08-15 21:15:04 UTC) #1
benjhayden
For a little context, I ran into this crash while fixing another crash by rewriting ...
8 years, 4 months ago (2012-08-15 21:31:23 UTC) #2
brettw
http://codereview.chromium.org/10831337/diff/1/base/nix/mime_util_xdg.cc File base/nix/mime_util_xdg.cc (right): http://codereview.chromium.org/10831337/diff/1/base/nix/mime_util_xdg.cc#newcode591 base/nix/mime_util_xdg.cc:591: if (filepath.empty()) return ""; Don't use single-line style except ...
8 years, 4 months ago (2012-08-16 03:37:33 UTC) #3
benjhayden
PTAL http://codereview.chromium.org/10831337/diff/1/base/nix/mime_util_xdg.cc File base/nix/mime_util_xdg.cc (right): http://codereview.chromium.org/10831337/diff/1/base/nix/mime_util_xdg.cc#newcode591 base/nix/mime_util_xdg.cc:591: if (filepath.empty()) return ""; On 2012/08/16 03:37:34, brettw ...
8 years, 4 months ago (2012-08-16 14:33:34 UTC) #4
brettw
lgtm
8 years, 4 months ago (2012-08-19 22:30:54 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/benjhayden@chromium.org/10831337/5002
8 years, 4 months ago (2012-08-20 15:36:17 UTC) #6
commit-bot: I haz the power
Change committed as 152347
8 years, 4 months ago (2012-08-20 17:15:47 UTC) #7
Lei Zhang
https://chromiumcodereview.appspot.com/10831337/diff/5002/base/nix/mime_util_xdg.cc File base/nix/mime_util_xdg.cc (right): https://chromiumcodereview.appspot.com/10831337/diff/5002/base/nix/mime_util_xdg.cc#newcode591 base/nix/mime_util_xdg.cc:591: if (filepath.empty()) Curious, who is calling GetFileMimeType with an ...
8 years, 4 months ago (2012-08-22 05:59:10 UTC) #8
benjhayden
https://chromiumcodereview.appspot.com/10831337/diff/5002/base/nix/mime_util_xdg.cc File base/nix/mime_util_xdg.cc (right): https://chromiumcodereview.appspot.com/10831337/diff/5002/base/nix/mime_util_xdg.cc#newcode591 base/nix/mime_util_xdg.cc:591: if (filepath.empty()) On 2012/08/22 05:59:10, Lei Zhang wrote: > ...
8 years, 4 months ago (2012-08-22 14:24:14 UTC) #9
Lei Zhang
8 years, 4 months ago (2012-08-22 18:43:20 UTC) #10
On 2012/08/22 14:24:14, benjhayden_chromium wrote:
>
https://chromiumcodereview.appspot.com/10831337/diff/5002/base/nix/mime_util_...
> File base/nix/mime_util_xdg.cc (right):
> 
>
https://chromiumcodereview.appspot.com/10831337/diff/5002/base/nix/mime_util_...
> base/nix/mime_util_xdg.cc:591: if (filepath.empty())
> On 2012/08/22 05:59:10, Lei Zhang wrote:
> > Curious, who is calling GetFileMimeType with an empty filepath?
> > IconManager::LoadIcon() ?
> 
> Yes, LoadIcon() doesn't early-return for empty paths, iirc.
> No, nothing is currently calling LoadIcon() with an empty path, afaik. We're
> currently refactoring the downloads system, and in a few of my recent
refactors,
> I had bugs where I was calling LoadIcon() with an empty path. I fixed the
bugs,
> but until I get around to writing a lot more tests, it could easily come back,
> and I'd rather display a blank icon than crash.

I would suggest adding a NOTREACHED() there, so developers know its not suppose
to happen, rather than letting the bug go by silently.

Powered by Google App Engine
This is Rietveld 408576698