mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 961498: Prevent ICO decoder from exploding when faced with single-resource ICOs r=rnewman
This commit is contained in:
parent
b43ef033c1
commit
37e4b74a7b
@ -5,7 +5,6 @@
|
||||
package org.mozilla.gecko.favicons.decoders;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
|
||||
import java.util.Iterator;
|
||||
@ -87,7 +86,7 @@ public class FaviconDecoder {
|
||||
result = new LoadFaviconResult();
|
||||
result.mOffset = offset;
|
||||
result.mLength = length;
|
||||
result.mHasMultipleBitmaps = false;
|
||||
result.mIsICO = false;
|
||||
|
||||
// We assume here that decodeByteArray doesn't hold on to the entire supplied
|
||||
// buffer -- worst case, each of our buffers will be twice the necessary size.
|
||||
|
@ -345,7 +345,7 @@ public class ICODecoder implements Iterable<Bitmap> {
|
||||
result.mFaviconBytes = mDecodand;
|
||||
result.mOffset = mOffset;
|
||||
result.mLength = mLen;
|
||||
result.mHasMultipleBitmaps = mIconDirectory.length > 1;
|
||||
result.mIsICO = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class LoadFaviconResult {
|
||||
int mOffset;
|
||||
int mLength;
|
||||
|
||||
boolean mHasMultipleBitmaps;
|
||||
boolean mIsICO;
|
||||
Iterator<Bitmap> mBitmapsDecoded;
|
||||
|
||||
public Iterator<Bitmap> getBitmaps() {
|
||||
@ -49,7 +49,7 @@ public class LoadFaviconResult {
|
||||
|
||||
// For results containing a single image, we re-encode the result as a PNG in an effort to
|
||||
// save space.
|
||||
if (!mHasMultipleBitmaps) {
|
||||
if (!mIsICO) {
|
||||
Bitmap favicon = ((FaviconDecoder.SingleBitmapIterator) mBitmapsDecoded).peek();
|
||||
byte[] data = null;
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
|
Loading…
Reference in New Issue
Block a user