arib06 opened a new pull request, #3964: URL: https://github.com/apache/avro/pull/3964
## What is the purpose of the change `Avro::BinaryDecoder` skips a writer field it does not need with `$reader->seek($n, 0)`, but whence `0` is `SEEK_SET` (absolute) rather than `SEEK_CUR` (relative). `skip_bytes` (also used for `skip_string`) and `skip_fixed` therefore jump to an absolute offset equal to the field length instead of advancing past the field. When a reader schema projects away a `bytes`/`string`/`fixed` field that is not the last writer field, the stream position is left wrong and every following field is decoded from the wrong offset, silently yielding wrong values (or a later marker-mismatch error on data files). The sibling `decode_bytes`/`decode_fixed` consume exactly the field bytes, so this only affects the skip path. Using `Fcntl->SEEK_CUR` makes the skip advance from the current position. ## Verifying this change This change added tests and can be verified as follows: - Added cases to `t/03_bin_decode.t` that decode a record with a projecting reader schema where a skipped `bytes` field and a skipped `fixed` field are each followed by another field. The trailing field now decodes correctly; on the current code it reads a wrong value. ## Documentation - Does this pull request introduce a new feature? no -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
