We set the length of a slot as '-len' (i.e. the negative of the length) if the slot contains an escaped character.
If the caller of WriteSlot() is about to pass a slot with an escaped character to WriteSlot(), it makes sure it sets the 'len' argument to positive and sets the 'need_escape' argument to true.
A slot with '\N' (a default negative slot) will always have a negative length of -2, since it contains an escape character. WriteSlot() will receive the length for this slot as '2' (positive) and do a NULL check successfully.
CodegenWriteSlot() uses the IRBuilder and the argument it receives for 'len' will be negative if the passed 'data' has an escape character. It then passes this negative length directly to the IrIsNullString() or IrGenericIsNullString() functions which do not expect a negative length.
Therefore no slots will be marked as NULL slots by this check when codegen is enabled.
We've been getting by so far because there was some buggy code after the NULL check which marked invalid blocks and NULL blocks as NULL instead of giving an error back to the user for the invalid blocks case, leading to