Icons: Why do we add 1 to the content length header when decoding icons?

NEW
Unassigned

Status

()

Firefox for Android
Favicon Handling
P3
normal
a year ago
a year ago

People

(Reporter: sebastian, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

This came up in bug 1290014.

LoadFaviconTask:
https://dxr.mozilla.org/mozilla-central/rev/3ba5426a03b495b6417fffb872d42874edb80855/mobile/android/base/java/org/mozilla/gecko/favicons/LoadFaviconTask.java#347

> if (response.contentLength > 0) {
>    // The size was reported and sane, so let's use that.
>    // Integer overflow should not be a problem for Favicon sizes...
>   bufferSize = response.contentLength + 1;
> }

Why do we add one to the content length to get the buffer size?

It looks like the code came in here (bug 748100):
https://hg.mozilla.org/mozilla-central/rev/1c402a47da51

Unfortunately there's no explanation why the "+1" was added. It looks wrong.
Priority: -- → P3
OS: Unspecified → Android
Hardware: Unspecified → All
You need to log in before you can comment on or make changes to this bug.