Opened 12 years ago

Closed 12 years ago

#1968 closed defect (fixed)

MgRaster serialization error

Reported by: jng Owned by:
Priority: high Milestone: 2.4
Component: Feature Service Version:
Severity: critical Keywords:
Cc: External ID:

Description

Attempting to serialize a MgRaster with palette information will crash the MapGuide Server.

The problem is that the m_palette member is a MgByte, which does not inherit from MgSerializable, thus the resulting call to MgStreamWriter::WriteObject() performs an invalid cast on the MgByte to MgSerializable

The solution is to either:

Attachments (2)

1968.patch (1.5 KB ) - added by jng 12 years ago.
Fix serialization/deserialization
Raster.cpp.patch (1.4 KB ) - added by jng 12 years ago.
Testing tab formatting

Download all attachments as: .zip

Change History (4)

by jng, 12 years ago

Attachment: 1968.patch added

Fix serialization/deserialization

comment:1 by trevorwekel, 12 years ago

Hi Jackie, the patch is fine. You might want to check your tab settings. The alignment looks off in the patch.

You may also want to add a dynamic cast to MgSerializable from MgObject in MgStreamWriter::WriteObject, check for NULL, and throw an exception.

The blind cast from MgObject to MgSerializable is bad. Ideally, WriteObject should be taking an MgSerializable. Unfortunately, that change would impact MgCommand logic and may be too invasive. Maybe a 2.5 item.

I did a search in the code base for WriteObject taking non-serializable arguments. I didn't see any other instances of this. Near as I can tell, this has been in here for years.

by jng, 12 years ago

Attachment: Raster.cpp.patch added

Testing tab formatting

comment:2 by jng, 12 years ago

Resolution: fixed
Status: newclosed

Fixed r6547

Note: See TracTickets for help on using tickets.