First post, by realnc
- Rank
- Oldbie
There's a few places in the dosbox code where sanitizers detect null pointer derefs at runtime. Example:
$ ./dosbox...dbopl.cpp:1447:47: runtime error: member access within null pointer of type 'DBOPL::Chip'dbopl.cpp:1462:47: runtime error: member access within null pointer of type 'DBOPL::Channel'...
The code is:
//Create a table with offsets of the channels from the start of the chipDBOPL::Chip* chip = 0;for ( Bitu i = 0; i < 32; i++ ) {Bitu index = i & 0xf;if ( index >= 9 ) {ChanOffsetTable[i] = 0;continue;}//Make sure the four op channels follow eachotherif ( index < 6 ) {index = (index % 3) * 2 + ( index / 3 );}//Add back the bits for highest onesif ( i >= 16 )index += 9;Bitu blah = reinterpret_cast<Bitu>( &(chip->chan[ index ]) ); <====== *** HERE ***ChanOffsetTable[i] = blah;}
What's the intent here? Or are these just plain old bugs?