handle_charref crash when unfortunate character sequencer in feed.

10 views
Skip to first unread message

David Walker

unread,
May 16, 2013, 4:05:54 PM5/16/13
to miro-communit...@googlegroups.com
I started getting this crash report when I signed up to the Linux Action Show:

Exception
---------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/miro/trapcall.py", line 43, in trap_call
    function(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/miro/workerprocess.py", line 84, in handle_task_result
    _task_queue.process_result(msg)
  File "/usr/lib/pymodules/python2.7/miro/workerprocess.py", line 108, in process_result
    callback(reply.result)
  File "/usr/lib/pymodules/python2.7/miro/feed.py", line 1439, in feedparser_callback
    self.create_items_for_parsed(parsed)
  File "/usr/lib/pymodules/python2.7/miro/feed.py", line 1244, in create_items_for_parsed
    self._create_items_for_parsed(parsed)
  File "/usr/lib/pymodules/python2.7/miro/feed.py", line 1315, in _create_items_for_parsed
    self._handle_new_entry(entry, fp_values, channel_title)
  File "/usr/lib/pymodules/python2.7/miro/feed.py", line 1233, in _handle_new_entry
    channel_title=channel_title)
  File "/usr/lib/pymodules/python2.7/miro/database.py", line 560, in __init__
    self.after_setup_new()
  File "/usr/lib/pymodules/python2.7/miro/item.py", line 413, in after_setup_new
    app.item_info_cache.item_created(self)
  File "/usr/lib/pymodules/python2.7/miro/iteminfocache.py", line 234, in item_created
    info = itemsource.DatabaseItemSource._item_info_for(item)
  File "/usr/lib/pymodules/python2.7/miro/itemsource.py", line 243, in _item_info_for
    return messages.ItemInfo(item.id, **info)
  File "/usr/lib/pymodules/python2.7/miro/messages.py", line 1190, in __init__
    self.description)
  File "/usr/lib/pymodules/python2.7/miro/util.py", line 899, in strip
    self.feed(s)
  File "/usr/lib/python2.7/sgmllib.py", line 104, in feed
    self.goahead(0)
  File "/usr/lib/python2.7/sgmllib.py", line 186, in goahead
    self.handle_charref(name)
  File "/usr/lib/pymodules/python2.7/miro/util.py", line 942, in handle_charref
    charnum = int(ref)
ValueError: invalid literal for int() with base 10: 'C'


After a bit of digging I noticed that handle_charref was trying to handle a piece of text which was apart of a profanity: &#C; which obviously looks like it might be html char ref, but in fact is an unfortunate sequence of key strokes. 

I changed the code to the following:

    def handle_charref(self, ref):
print "handle charref"
print ref
        if ref.startswith('x'):
            charnum = int(ref[1:], 16)
        else:
            # old code was just this:
            #charnum = int(ref) 

            # my mod
            if ref.isdigit():
       charnum = int(ref)
   else:
                charnum = ord(ref)
        self._add(unichr(charnum))

Which stops miro crashing, but I don't think is a very good fix. Does someone want to take a look and maybe report it?

Thanks.

Stephen Burrows

unread,
May 17, 2013, 1:23:32 PM5/17/13
to miro-communit...@googlegroups.com
Hi, David,

This is the mailing list for Miro Community, which (despite the similar name) is unrelated to the Miro video player. I'd recommend checking out their development wiki for where to send your report: http://develop.participatoryculture.org/index.php/MiroStart

Best,
Stephen


--
You received this message because you are subscribed to the Google Groups "Miro Community Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to miro-community-deve...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages