Last modified: 2014-02-28 16:24:34 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T46255, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44255 - Windows 8 app has terrible error checking for feed contents
Windows 8 app has terrible error checking for feed contents
Status: NEW
Product: Unofficial Apps
Classification: Unclassified
Wikipedia/Windows 8 (Other open bugs)
unspecified
All All
: Low normal
: ---
Assigned To: Brion Vibber
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-22 20:08 UTC by Brion Vibber
Modified: 2014-02-28 16:24 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: Windows 8 / Windows RT
Assignee Huggle Beta Tester: ---


Attachments

Description Brion Vibber 2013-01-22 20:08:07 UTC
There's a lot of places in the feed processing for the Windows 8 app where unexpected data formats just kill the app.

Need to add better error handling so it survives any input.
Comment 1 Brian R. Bondy 2013-03-06 17:05:31 UTC
Could you give me an example?
Comment 2 Brion Vibber 2013-03-06 17:29:38 UTC
I unfortunately didn't save a broken sample feed, but last one I had to fix was a weirdly-formatted entry in I think the 'featured articles' feed on en.wikipedia.org.

Here's the workaround I put in place to fix that:
https://en.wikipedia.org/w/index.php?title=Wikipedia:Today%27s_featured_article/January_20,_2013&diff=534362579&oldid=533956507
this adds a hidden link to the item that took priority over the media item or whatever that was in there that got misdetected.


All the code in default.js is a bit ..... haphazard, it needs a refactor. :)

But there'll be a bit that fetches a feed like this:

        fetchFeed(lang, 'featured', function (htmlList, err) {
            ....

and inside there is where the Evil Code lies.

There's stuff like this:

                var $html = $('<div>').html(html),
                    $links = $html.find('a'),
                    $imgs = $html.find('img'),
                    title = '',
                    image = '';
                for (var i = 0; i < $links.length; i++) {
                    var $link = $($links[i]);
                    if ($link.find('img').length) {
                        // Skip a link containing an image
                        continue;
                    }
                    title = extractWikiTitle($link.attr('href'));
                    break;
                }

which tries to extract an image and a wiki link from the entry.

In some cases the link ends up being something that's not in the expected "/wiki/Something" format and extractWikiTitle throws an exception.

Because the feed-handling code doesn't expect this, the exception doesn't get caught and kills the application before we've gotten a chance to show anything.


You can probably pull down a copy of the Atom feed, mess with it, and experience all kinds of fun crashes. :)
Comment 3 Brion Vibber 2013-10-30 00:32:51 UTC
Grouping Windows 8 app specific bugs to Wikipedia/Windows 8 component.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links