FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

[linux-minidisc] [PATCH 12/17] Always check group track are in disk boundaries.

<-- thread -->
<-- date -->
  • From: Vincent Pelletier <plr.vincent@gmail.com>
  • To: <linux-minidisc@lists.fu-berlin.de>
  • Date: Thu, 28 Jan 2010 08:12:47 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:in-reply-to:references:from:date:subject:to:mime-version :content-type:x-bogosity:x-uid; b=mbSOESxZNkGRrHa+l03Ck/Nl6HpdW2m8RVjILTN2K5EWijrOumz+NtS3ptRa2e6A2X Cc/LWNLGntpDYzuYkDf90n9CzTqhYW4NaALFhy+d6uGZ6TZDYdJXk/fZ8N54+YT5kp+r 8lNh25HJnY1wsqX/leYjnWw5bbvLg9crOtuLA=
  • Subject: [linux-minidisc] [PATCH 12/17] Always check group track are in disk boundaries.

---
 netmd/libnetmd.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/netmd/libnetmd.py b/netmd/libnetmd.py
index def234a..a66a9d9 100644
--- a/netmd/libnetmd.py
+++ b/netmd/libnetmd.py
@@ -674,6 +674,7 @@ class NetMDInterface(object):
         raw_title = self._getDiscTitle()
         group_list = raw_title.split('//')
         track_dict = {}
+        track_count = self.getTrackCount()
         result = []
         append = result.append
         for group_index, group in enumerate(group_list):
@@ -684,12 +685,14 @@ class NetMDInterface(object):
             track_range, group_name = group.split(';', 1)
             if '-' in track_range:
                 track_min, track_max = track_range.split('-')
-                assert track_min < track_max, '%r, %r' % (track_min, track_max)
             else:
                 track_min = track_max = track_range
+            track_min, track_max = int(track_min), int(track_max)
+            assert 0 <= track_min <= track_max <= track_count, (
+                track_min, track_max, track_count)
             track_list = []
             track_append = track_list.append
-            for track in xrange(int(track_min) - 1, int(track_max)):
+            for track in xrange(track_min - 1, track_max):
                 if track in track_dict:
                     raise ValueError, 'Track %i is in 2 groups: %r[%i] & ' \
                          '%r[%i]' % (track, track_dict[track][0],
<-- thread -->
<-- date -->
  • References:
    • [linux-minidisc] [PATCH 01/17] Make function acting on a transfer accept a pointer to transfer.
      • From: Vincent Pelletier <plr.vincent@gmail.com>
  • linux-minidisc - January 2010 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the linux-minidisc mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal