Jump to content

New Storage Bug Found in Windows Phone 8


Recommended Posts

Developer discovers storage bug when saving images to Windows Phones

We've covered issues with "Other Storage" fairly extensively in the past, but now we're taking a quick look at a find by Kévin Gosse in his Windows Phone app Imageboard Browser. The app has been causing problems with users as sometimes hundreds of megabytes of data would be stored and taking up valuable space, but this isn't related to other storage so what's going on?

Gosse managed to track the issue to the methods MediaLibrary.SavePicture and MediaLibrary.SavePictureToCameraRoll. Both are utilised when saving images to a Windows Phone's pictures hub. It's reported that each and every time they're used, a copy of said image being saved is also stored in isolated storage.

After creating a small app to test out his theory, Gosse confirms that when an image is downloaded and saved locally, a copy can be detected in isolated storage. It's a bug that can be easily overlooked. Here are more findings:

  • Gosse could not reproduce the bug on Windows Phone 7; only Windows Phone 8 appears to be affected.
  • Various hardware (Lumia 822, Lumia 920, and the emulator) was tested. It's not device-specific.
  • The bug occurs only when saving JPG pictures. Nothing is stored on the isolated storage when saving a PNG picture.
  • If it's anticipated and a file is created beforehand on the isolated storage with the same name, it will be overwritten. If it's locked by keeping the stream open, the MediaLibrary.SavePicture method throws an exception.
  • The MediaLibrary.SavePicture has an overload that expect a byte array rather than a stream. It suffers from the same bug.
  • The name of the file created in the isolated storage is the same name as the one provided to the MediaLibrary.SavePicture, with “.jpg” appended to the end (even if the name already contained “.jpg”), and dots ‘.’ replaced by underscores ‘_’. Knowing this, it’s possible to write code to automatically delete the file.
  • Using Nokia’s storage tool, those files are reported in the application’s dedicated storage. Not in the temp files or the “others” storage.

Note the second-to-last point as Gosse states it's easy to workaround. This can be achieved by automatically removing the temporary file that's created in isolated storage. This could cause serious issues with those who are on low-end hardware and only have limited amounts of internal storage. Something to keep an eye on, developers.

Source: Codes Sources; thanks, Jorba, for the tip!, WPCentral

Link to comment
Share on other sites

  • Views 1.4k
  • Created
  • Last Reply


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...