Bug #8500

date_core testing address not value of variable on stack

Added by Riley Lynch 11 months ago. Updated 11 months ago.

[ruby-core:55337]
Status:Closed
Priority:Low
Assignee:-
Category:ext
Target version:-
ruby -v:ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-darwin12.3.0] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

=begin
This line appears ten times in date_core.c:

decode_year(y, ns ? -1 : +1, &nth2, ry);

The type of ns is int*, and it seems to always be populated with the address of a stack variable, with the effect that the condition is always true. It looks like the intent is to ensure that decode_year uses Gregorian years if the value ns is true, i.e.:

decode_year(y, *ns ? -1 : +1, &nth2, ry);

It may be the case that this code is unreachable: guess_style() would have to return zero and nth would have to be calculated to be greater or less than zero. Is there any way that could happen?
=end

email.patch Magnifier (2.5 KB) Riley Lynch, 06/06/2013 05:09 PM


Related issues

Related to Backport200 - Backport #8578: r41077, r41105 Closed 06/29/2013

History

#1 Updated by tadayoshi funaba 11 months ago

  • Status changed from Open to Closed
  • Priority changed from Normal to Low

coding error;
but, it seems to lack effects.
thanks.

Also available in: Atom PDF