bugGNUstep - Bugs: bug #32434, crash in...


You are not allowed to post comments on this tracker with your current authentication level.

bug #32434: crash in NSNumberFormatter-getObjectValue:forString:

Submitted by:  Riccardo Mottola <rmottola>
Submitted on:  Sat 12 Feb 2011 09:37:12 AM UTC  
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  None Status:  Ready For Test
Privacy:  Public Assigned to:  None
Open/Closed:  In Test

( Jump to the original submission)

Fri 18 Mar 2011 02:12:09 PM UTC, comment #7:

The changes I made require ICU... I didn't change the other code that doesn't require it. Did not even look at it, either.

Stef <stefanbidi>
Project Member
Fri 18 Mar 2011 11:15:24 AM UTC, comment #6:

I did a quick test with the original app using a system without ICU.

1.01 works now. However, 1.1 gets transformed into 1.01! We have the reverse problem.
I should add a test for that case too.

Riccardo Mottola <rmottola>
Project Member
Mon 14 Mar 2011 11:07:46 PM UTC, comment #5:

I just added some code to SVN that is able to run your example. Let me know if it works as you'd expect. I had to take a few liberties when creating the NSError object in -getObjectValue:forString:range:error: (the underlying method used to implement this one).

Stef <stefanbidi>
Project Member
Mon 14 Mar 2011 08:28:23 PM UTC, comment #4:

I'll try to implement this with the libicu stuff, shouldn't be much of a problem. I can't promise it'll make it into the next release, but I'll give it a shot. Could you attach the expected output? I see a similar test in the testsuite, but it doesn't test for the -1.01 value, which I find more interesting than 0.00. Also, can you double check that the output of -formatterBehavior is in fact NSNumberFormatterBehavior10_4?

Stef <stefanbidi>
Project Member
Sat 19 Feb 2011 12:30:11 AM UTC, comment #3:

The attached example works on Mac but not on GNustep.

(file #22728)

Riccardo Mottola <rmottola>
Project Member
Thu 17 Feb 2011 12:17:40 AM UTC, comment #2:

The current code of trunk makes a segfault:

0xb71c6063 in -[NSNumberFormatter setDecimalSeparator:] (self=0x905da18,
_cmd=0xb74237b8, newSeparator=0x9180bd8) at NSNumberFormatter.m:647
647 if (internal->_behavior == NSNumberFormatterBehavior10_4
(gdb) bt
#0 0xb71c6063 in -[NSNumberFormatter setDecimalSeparator:] (self=0x905da18,
_cmd=0xb74237b8, newSeparator=0x9180bd8) at NSNumberFormatter.m:647
#1 0xb71c5a2d in -[NSNumberFormatter initWithCoder:] (self=0x905da18,
_cmd=0xb7417c08, decoder=0x9149c70) at NSNumberFormatter.m:483
#2 0xb71a5271 in -[NSKeyedUnarchiver(Private) _decodeObject:] (
self=0x9149c70, _cmd=0xb7417bc8, index=228) at NSKeyedUnarchiver.m:220
#3 0xb71a35e8 in -[NSKeyedUnarchiver decodeObjectForKey:] (self=0x9149c70,
_cmd=0xb77e3108, aKey=0xb77e32f0) at NSKeyedUnarchiver.m:602
#4 0xb75765aa in -[NSCell initWithCoder:] (self=0x91e6fa8, _cmd=0xb77c4a10,
aDecoder=0x9149c70) at NSCell.m:2575
#5 0xb752120e in -[NSActionCell initWithCoder:] (self=0x91e6fa8,
_cmd=0xb785c390, aDecoder=0x9149c70) at NSActionCell.m:379
#6 0xb768b30e in -[NSTextFieldCell initWithCoder:] (self=0x91e6fa8,
_cmd=0xb7417c08, aDecoder=0x9149c70) at NSTextFieldCell.m:329
#7 0xb71a5271 in -[NSKeyedUnarchiver(Private) _decodeObject:] (
self=0x9149c70, _cmd=0xb7417bc8, index=227) at NSKeyedUnarchiver.m:220
#8 0xb71a35e8 in -[NSKeyedUnarchiver decodeObjectForKey:] (self=0x9149c70,
_cmd=0xb77f1608, aKey=0xb77f16a0) at NSKeyedUnarchiver.m:602
#9 0xb7598109 in -[NSControl initWithCoder:] (self=0x8f7cfa0,
_cmd=0xb785b7b0, aDecoder=0x9149c70) at NSControl.m:965
#10 0xb7689b7e in -[NSTextField initWithCoder:] (self=0x8f7cfa0,
_cmd=0xb7417c08, aDecoder=0x9149c70) at NSTextField.m:757
#11 0xb71a5271 in -[NSKeyedUnarchiver(Private) _decodeObject:] (

(gdb) po newSeparator

Riccardo Mottola <rmottola>
Project Member
Sat 12 Feb 2011 05:17:25 PM UTC, comment #1:

Actually the string being converted is very simple, 0.00

I think the problem is that [self decimalSeparator] returns null.

In fact, adding a quick hack to always return @"." to decimalSeparator makes the NIB load although with some unexpected parameters.

Riccardo Mottola <rmottola>
Project Member
Sat 12 Feb 2011 09:37:12 AM UTC, original submission:

When loading a NIB file...

2011-02-12 10:28:21.472 Graphos[22201] NSNumberFormatter-getObjectValue:forString:... not fully implemented

Riccardo Mottola <rmottola>
Project Member


Attached Files
file #22728:  FormatterTest.m added by rmottola (555B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by stefanbidi (Posted a comment)
  • -email is unavailable- added by rmottola (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-03-14 stefanbidi StatusNone => Ready For Test
        Open/ClosedOpen => In Test
    2011-02-19 rmottola Attached File- => Added FormatterTest.m, #22728
    2011-02-17 rmottola SummaryNSNumberFormatter-getObjectValue:forString:... not fully implemented => crash in NSNumberFormatter-getObjectValue:forString:

    Back to the top

    Powered by Savane 3.4