Hyukjin Kwon created SPARK-61855:
------------------------------------

             Summary: Match upb in five edge cases of the Rust protobuf 
runtime: deep discards and builds, re-entrant container mutation, out-of-range 
tags, and map entries of unknown fields
                 Key: SPARK-61855
                 URL: https://issues.apache.org/jira/browse/SPARK-61855
             Project: Spark
          Issue Type: Bug
          Components: Connect
    Affects Versions: connect-rust-4.4.0
            Reporter: Hyukjin Kwon


The Rust protobuf runtime of the Python drop-in (crates/pyspark-rs/src/pbmsg), 
which pyspark.sql.connect.proto always exports since SPARK-61786, differs from 
upb (protobuf 7.36.2) in five edge cases, each reproduced against upb:
- DiscardUnknownFields() of a deeply nested message crashes the process 
(SIGSEGV) at depths that upb handles: it recurses without growing the stack, 
unlike every other recursive operation of the runtime.
- A message built of nested dicts (Relation(**nested), add(**kwargs)) crashes 
at depths that upb builds.
- A repeated or map field mutated re-entrantly (from an __index__, an __eq__, 
or the iterable of extend) or from another thread raises pyo3's PanicException, 
a BaseException, where upb completes: the containers hold their borrows while 
Python code runs.
- Field numbers above 2^29-1, and tags above 32 bits, are accepted (truncated 
to u32), where upb raises DecodeError "Wire format was corrupt".
- A map entry with an unknown field, or a key or value of the wrong wire type, 
is inserted into the map, where upb keeps the entry, re-encoded, in the unknown 
fields of the message.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to