Bug #7466 Creating bit fields of size 0 causes system failure
Submitted: 21 Dec 2004 21:11 Modified: 22 Dec 2004 5:25
Reporter: Martin Skold Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version: OS:
Assigned to: Jonas Oreland CPU Architecture:Any

[21 Dec 2004 21:11] Martin Skold
Description:
Creating a bit field in Ndb API with size 0 causes system failure,
this should be caught in Ndb API. From SQL this is allowed and
has the same effect as CHAR(0), i.e. a field that can be NULL or NOT NULL.

#0  0x0000002a95b556cd in raise () from /lib64/tls/libc.so.6
#1  0x0000002a95b56c7e in abort () from /lib64/tls/libc.so.6
#2  0x00000000005bfb04 in NdbShutdown (type=NST_ErrorHandler, 
    restartType=NRT_Default) at Emulator.cpp:244
#3  0x00000000005c4f68 in ErrorReporter::handleError (type=Variable "type" is not available.
)
    at ErrorReporter.cpp:203
#4  0x00000000005b97aa in SimulatedBlock::progError (this=0x2a96dfa010, 
    line=352, err_code=2341, extra=0x60df82 "DbtupMeta.cpp")
    at SimulatedBlock.cpp:728
#5  0x0000000000559865 in Dbtup::execTUP_ADD_ATTRREQ (this=0x2a96dfa010, 
    signal=0x840060) at DbtupMeta.cpp:352
#6  0x00000000005bc967 in FastScheduler::doJob (this=0x8499a0)
    at SimulatedBlock.hpp:529
#7  0x00000000005be07f in ThreadConfig::ipControlLoop (this=0x8540b0)
    at ThreadConfig.cpp:175
#8  0x0000000000472f48 in main (argc=3, argv=0x7fbfffee18) at main.cpp:203

How to repeat:
    col.setType(NDBCOL::Bit);
    col.setLength(0);

Suggested fix:
Change  so that a bit field will always have a lenght of at least 1 (max(1, no_of_bits))
[22 Dec 2004 5:00] Jonas Oreland
I'll add a check in NDB,
changing from bit(0) -> bit(1) can be done in the handler
[22 Dec 2004 5:25] Jonas Oreland
Fixed in 5.0-ndb
Will return error 736, unsupported array size