Opened 5 years ago

Closed 5 years ago

#2120 closed defect (fixed)

rasql --out string runs into a bug for complex scalars

Reported by: Dimitar Misev Owned by: apercov
Priority: major Milestone: 9.8
Component: rasql Version: 9.8
Keywords: Cc:
Complexity: Medium

Description

To reproduce:

$ rasql -q 'SELECT complex({1.2f, 2f}, {3f, 4.87f})' --out string
rasql: rasdaman query tool v1.0, rasdaman 9.8.0.
Opening database RASBASE at localhost:7001... ok.
Executing retrieval query... ok.
Query result collection has 1 element(s):
  Result element 1: { applications/rasql/rasql.cc:618:84: runtime error: downcast of address 0x6030000203b0 which does not point to an object of type 'r_Complex'
0x6030000203b0: note: object is of type 'r_Primitive'
 06 00 00 60  90 32 b2 2d 1d 56 00 00  90 33 01 00 40 60 00 00  f0 78 00 00 20 60 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'r_Primitive'
applications/rasql/rasql.cc:618:94: runtime error: member call on address 0x6030000203b0 which does not point to an object of type 'r_Complex'
0x6030000203b0: note: object is of type 'r_Primitive'
 06 00 00 60  90 32 b2 2d 1d 56 00 00  90 33 01 00 40 60 00 00  f0 78 00 00 20 60 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'r_Primitive'
applications/rasql/rasql.cc:618:164: runtime error: downcast of address 0x6030000203b0 which does not point to an object of type 'r_Complex'
0x6030000203b0: note: object is of type 'r_Primitive'
 06 00 00 60  90 32 b2 2d 1d 56 00 00  90 33 01 00 40 60 00 00  f0 78 00 00 20 60 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'r_Primitive'
applications/rasql/rasql.cc:618:174: runtime error: member call on address 0x6030000203b0 which does not point to an object of type 'r_Complex'
0x6030000203b0: note: object is of type 'r_Primitive'
 06 00 00 60  90 32 b2 2d 1d 56 00 00  90 33 01 00 40 60 00 00  f0 78 00 00 20 60 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'r_Primitive'
(1.2,3), (2,4.87) }
rasql done.

On source:applications/rasql/rasql.cc#L618, there's a cast to r_Complex, but the casted object is not r_Complex really. So it needs to be traced where this object is created, and it should be corrected so that an r_Complex is properly created.

To get the above errors, you need to add -DENABLE_ASAN=ON to cmake, then make clean and make/make install.

Change History (2)

comment:1 by apercov, 5 years ago

Status: newaccepted

comment:2 by Dimitar Misev, 5 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.