Opened 7 years ago

Closed 7 years ago

#1377 closed defect (fixed)

[with patch, with positive review] technically incorrect code in integer_mod.pyx

Reported by: cwitty Owned by: somebody
Priority: trivial Milestone: sage-2.9
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

There is code in integer_mod.pyx that coerces a Python int into an int_fast32_t. This is wrong, since a Python int can hold a C long; so this might truncate if sizeof(int_fast32_t) < sizeof(long).

However, the bug has little or no practical effect, since: 1) on 64-bit x86 Linux, sizeof(int_fast32_t) == sizeof(long); 2) the problem only occurs if you call IntegerMod_int directly (which nobody should); it looks like all the wrappers do the modulo before they create the IntegerMod_int.

Attachments (1)

1377.patch (727 bytes) - added by cwitty 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by cwitty

comment:1 Changed 7 years ago by robertwb

  • Component changed from algebraic geometry to basic arithmetic
  • Owner changed from was to somebody
  • Summary changed from [with patch] technically incorrect code in integer_mod.pyx to [with patch, with positive review] technically incorrect code in integer_mod.pyx

Looks good to me.

comment:2 Changed 7 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

Merged in 2.9.alpha0.

Note: See TracTickets for help on using tickets.