Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3549

[rust] Avro reader fails if it tries to read data compressed with codec that is not enabled in features

    XMLWordPrintableJSON

Details

    Description

      Minimal reproducible example:

      main.rs: https://gist.github.com/adensur/e9787daa19522caefe1473c7fcd8464f 

      Cargo.toml: https://gist.github.com/adensur/b9ebf7cd0714ed15938762375ae5e96e

      The result is different when building with "snappy" codec and without. Depending on the input, the result can be just wrong, or it can fail with an error similar to this:

      `ConvertI64ToUsize(TryFromIntError(()), -1976)'`

      From the code, it looks like the reader tries to parse known codecs from writer schema, and just uses default codec if it fails https://github.com/apache/avro/blob/master/lang/rust/avro/src/reader.rs#L202 

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              adensur Maksim Gaiduk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m