Edgewall Software

Ticket #7056: prevent-overflow.diff

File prevent-overflow.diff, 0.9 KB (added by thatch, 10 months ago)
  • trac/ticket/model.py

     
    8787        # Fetch the standard ticket fields 
    8888        std_fields = [f['name'] for f in self.fields if not f.get('custom')] 
    8989        cursor = db.cursor() 
    90         cursor.execute("SELECT %s,time,changetime FROM ticket WHERE id=%%s" 
    91                        % ','.join(std_fields), (tkt_id,)) 
    92         row = cursor.fetchone() 
     90        row = None 
     91        try: 
     92            cursor.execute("SELECT %s,time,changetime FROM ticket WHERE id=%%s" 
     93                           % ','.join(std_fields), (tkt_id,)) 
     94            row = cursor.fetchone() 
     95        except OverflowError, e: 
     96            pass 
    9397        if not row: 
    9498            raise ResourceNotFound('Ticket %s does not exist.' % tkt_id, 
    9599                                   'Invalid Ticket Number')