Skip to content

Commit

Permalink
Merge pull request #17645 from ghalliday/issue29301
Browse files Browse the repository at this point in the history
HPCC-29301 Guard against potential (theoretical) use of null pointer

Reviewed-By: Attila Vamos <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Aug 9, 2023
2 parents 7b59a86 + 7bcd9c4 commit 95c66b7
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions system/jhtree/jhinplace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2507,21 +2507,25 @@ void CInplaceLeafWriteNode::write(IFileIOStream *out, CRC32 *crc)
InplaceIndexCompressor::InplaceIndexCompressor(size32_t keyedSize, const CKeyHdr * keyHdr, IHThorIndexWriteArg * helper, const char * _compressionName)
: compressionName(_compressionName)
{
IOutputMetaData * format = helper->queryDiskRecordSize();
if (format)
if (helper)
{
//Create a representation of the null row - potentially used for the new compression algorithm
byte * nullRow = new byte[keyedSize];
RtlStaticRowBuilder rowBuilder(nullRow, keyedSize);

auto & meta = format->queryRecordAccessor(true);
size32_t offset = 0;
for (unsigned idx = 0; idx < meta.getNumFields() && offset < keyedSize; idx++)
//Nothing currently relies on the null row being created....
IOutputMetaData * format = helper->queryDiskRecordSize();
if (format)
{
const RtlFieldInfo *field = meta.queryField(idx);
offset = field->type->buildNull(rowBuilder, offset, field);
//Create a representation of the null row - potentially used for the new compression algorithm
byte * nullRow = new byte[keyedSize];
RtlStaticRowBuilder rowBuilder(nullRow, keyedSize);

auto & meta = format->queryRecordAccessor(true);
size32_t offset = 0;
for (unsigned idx = 0; idx < meta.getNumFields() && offset < keyedSize; idx++)
{
const RtlFieldInfo *field = meta.queryField(idx);
offset = field->type->buildNull(rowBuilder, offset, field);
}
ctx.nullRow = nullRow;
}
ctx.nullRow = nullRow;
}

//Process any options. Currently supports the compression mode
Expand Down

0 comments on commit 95c66b7

Please sign in to comment.