filter wide integers (closes #348)

This commit is contained in:
Adrian Sampson 2013-09-16 17:25:41 -07:00
parent bbac4ba109
commit c5de56c4fd
2 changed files with 9 additions and 1 deletions

View file

@ -471,7 +471,12 @@ class Item(LibModel):
traceback.format_exc())
for key in ITEM_KEYS_META:
setattr(self, key, getattr(f, key))
value = getattr(f, key)
if isinstance(value, (int, long)) and value.bit_length() > 63:
# Filter values wider than 64 bits (in signed
# representation). SQLite cannot store them.
value = 0
setattr(self, key, value)
# Database's mtime should now reflect the on-disk value.
if read_path == self.path:

View file

@ -22,6 +22,9 @@ And some fixes:
directory.
* :doc:`/plugins/echonest_tempo`: Fix an issue where the plugin could use the
tempo from the wrong song when the API did not contain the requested song.
* Fix a crash when a file's metadata included a very large number (one wider
than 64 bits). These huge numbers are now replaced with zeroes in the
database.
.. _Opus: http://www.opus-codec.org/