Skip to content

Commit 0fac0d5

Browse files
committed
fix: restrict KML image downloads to http/https schemes and remove local fallback
1 parent bce193a commit 0fac0d5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

library/src/main/java/com/google/maps/android/data/kml/KmlRenderer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,6 @@ public MarkerIconImageDownload(String iconUrl) {
538538
protected Bitmap doInBackground(String... params) {
539539
try {
540540
return getBitmapFromUrl(mIconUrl);
541-
} catch (MalformedURLException e) {
542-
return BitmapFactory.decodeFile(mIconUrl);
543541
} catch (IOException e) {
544542
e.printStackTrace();
545543
}
@@ -588,8 +586,6 @@ public GroundOverlayImageDownload(String groundOverlayUrl) {
588586
protected Bitmap doInBackground(String... params) {
589587
try {
590588
return getBitmapFromUrl(mGroundOverlayUrl);
591-
} catch (MalformedURLException e) {
592-
return BitmapFactory.decodeFile(mGroundOverlayUrl);
593589
} catch (IOException e) {
594590
Log.e(LOG_TAG, "Image [" + mGroundOverlayUrl + "] download issue", e);
595591
}
@@ -621,7 +617,11 @@ protected void onPostExecute(Bitmap bitmap) {
621617
* @return the bitmap of that image, scaled according to screen density.
622618
*/
623619
private Bitmap getBitmapFromUrl(String url) throws IOException {
624-
return BitmapFactory.decodeStream(openConnectionCheckRedirects(new URL(url).openConnection()));
620+
URL parsedUrl = new URL(url);
621+
if (!parsedUrl.getProtocol().equalsIgnoreCase("http") && !parsedUrl.getProtocol().equalsIgnoreCase("https")) {
622+
throw new MalformedURLException("Unsupported scheme: " + parsedUrl.getProtocol());
623+
}
624+
return BitmapFactory.decodeStream(openConnectionCheckRedirects(parsedUrl.openConnection()));
625625
}
626626

627627
/**

0 commit comments

Comments
 (0)