bugGNUstep - Bugs: bug #21133, NSKeyedArchiver doesn't encode...

Group
 
 

bug #21133: NSKeyedArchiver doesn't encode NSData correctly

Submitter:  Pauli Ojala <pojala>
Submitted:  Fri 21 Sep 2007 09:01:52 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 30 Jan 2009 07:31:00 PM UTC, comment #2: 

fixed

Richard Frith-Macdonald <CaS>
Group Member
Wed 03 Oct 2007 05:37:42 AM UTC, comment #1: 

I think the actual problem was with NSData returning the wrong value in the classForCoder: method.
I've corrected that ... please could you test and confirm that it works.

Richard Frith-Macdonald <CaS>
Group Member
Fri 21 Sep 2007 09:01:52 PM UTC, original submission:  


NSKeyedArchiver doesn't properly encode an NSData object's contents as a data block. The reason for this appears to be that NSData is a class cluster but NSKeyedArchiver fails to check for NSData's concrete subclasses (e.g. NSDataMalloc) when encoding.

On line 248 in NSKeyedArchiver.m, the following check is performed to determine if an object is stored directly:

      if (c == [NSString class]
        || c == [NSNumber class]
        || c == [NSDate class]
        || c == [NSData class]
              )

Adding the following additional conditions resolved the problem for me:

        || [c isSubclassOfClass:[NSString class]]
        || [c isSubclassOfClass:[NSNumber class]]
        || [c isSubclassOfClass:[NSDate class]]
        || [c isSubclassOfClass:[NSData class]]


Pauli Ojala <pojala>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-01-30 CaS Open/ClosedIn Test Closed
    2007-10-03 CaS StatusNone Fixed
        Open/ClosedOpen In Test
    2007-09-21 pojala Carbon-Copy- Added pojala

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code