ARROW-10448: [Rust] Remove PrimitiveArray::new that can cause UB#8560
ARROW-10448: [Rust] Remove PrimitiveArray::new that can cause UB#8560jorgecarleitao wants to merge 1 commit intoapache:masterfrom jorgecarleitao:remove_new
Conversation
|
I think we have a similar problem with building arrays from So something like the below gets created, but ends up as a 0-len array // try build array data without specifying length
ArrayData::builder(DataType::_).buffers(vec![buffer1, buffer2]).build() |
That is a very good point. I think that we have a trade-off here: do we check that the This could be a good topic for the mailing list, as it is a general question, specially for IPC and the c data interface. |
|
Is it the case that "UB" means "Undefined Behavior"? |
This PR removes
PrimitiveArray::new.PrimitiveArray::newispub, but it is dangerous because:null_count > 0, many calls panic as the null bitmap isNone, but thenull_count != 0null_count > 0, it creates an array out of spec (as the buffer for the null bitmap isNonebut the null count is not zero)Since:
null_count) requires a backward incompatible changeThis PR removes it.