Edgewall Software

Ticket #4794 (closed defect: fixed)

Opened 23 months ago

Last modified 23 months ago

Error if ticket reference is bigger than sys.maxint

Reported by: anonymous Owned by: cboos
Priority: high Milestone: 0.10.4
Component: wiki system Version: 0.10.3
Severity: normal Keywords: traclinks
Cc:

Description (last modified by cboos) (diff)

If you have "#12222222 22222222" (I put the space in there only so trac's trac doesn't crash due to this same bug) on a Wiki page or in a subversion commit log, trac tries to look up that ticket number. If the number is larger than maxint, there is an error. This makes the revision log and the timeline unusable. I'm not sure if it is strictly a postfix problem or not. I fixed it by adding

if long(target) < maxint

to api.py, just before:

                cursor = formatter.db.cursor()
                cursor.execute("SELECT summary,status FROM ticket WHERE id=%s",
                               (str(int(target)),))
                row = cursor.fetchone()
                if row:
                    return html.A(label, class_='%s ticket' % row[1],
                                  title=shorten_line(row[0]) + ' (%s)' % row[1],
                                  href=formatter.href.ticket(target))

and indenting those lines (at about line 215). Of course, I added "from sys import maxint" at the top.

I think that will fix the same problem for report numbers as well.

Attachments

Change History

Changed 23 months ago by eli.carter@…

Looks like #4792 and #4793 are nice demos of the same problem in the ticket system...

Changed 23 months ago by cboos

  • description modified (diff)

Seems this is PostgreSQL specific (works fine with SQLite and MySQL).

With PostgreSQL, #2147483647 works but #2147483647+1 doesn't ;-) So yes, checking against sys.maxint seems the right thing to do (would be worth a check on a 64-bits machine, though).

Changed 23 months ago by cboos

  • owner changed from jonas to cboos
  • priority changed from normal to high
  • component changed from general to wiki
  • milestone set to 0.10.4

Changed 23 months ago by cboos

  • keywords traclinks added
  • status changed from new to assigned

Should be fixed in r4806 (trunk) and r4807 (0.10-stable).

Need to verify if the fix works on 64-bits machines as well..

Changed 23 months ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Ok, this needed a follow-up in order to work on 64-bits machines: r4808 (trunk) and r4809 (0.10-stable).

Add/Change #4794 (Error if ticket reference is bigger than sys.maxint)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.