-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Sony ARW medium and small compression 15 bit per sample files are unsupported #4361
Comments
We rely on libraw to decode that file type. I think that maybe this means that libraw itself doesn't handle that bit depth for that file? I don't think there's a lot we can directly do until libraw supports it. Maybe you should file an issue against that project? |
What version of LibRaw do you use? Here is sample above processed with dcraw_emu -T -w: https://www.dropbox.com/scl/fi/wm2ef2atvy8korg1nn32z/A1A04973.ARW.tiff?rlkey=4yt4so6osoevy74m129ka9p1d&dl=0 |
Hi, @LibRaw , thanks so much for chiming in. According to the log posted above, the OP was using LibRaw 0.21.2. I'm not sure exactly how that corresponds to the snapshot you refer to. |
LibRaw 0.21.0 was released in 2022. At the time of this release, this format did not yet exist in Sony cameras. 0.21.xx is bugfixes only, no new cameras/formats to preserve API/ABI. Our release policy is described in details in project description on Github and/or on project homepage. |
Initial testing for reproduction was done with homebrew oiiotool which is version 2.5.12.0 with libraw 0.21.2 as you said, but our application is using 2.4.11.0 internally with Libraw 20240710. Initial post was using the latest OIIO from homebrew since it was also reproducing the not being able to save issue, and our build system does not build oiiotool. I'm not sure if a crash related to this was fixed between OIIO versions, but here is part of the crash report for reference.
If a crash related to this was fixed we can try to update to OIIO 2.5 internally, but this will take us some time. |
@lingyukongt LibRaw snapshots are NOT binary (ABI) compatible unless such compatibility is declared (e.g. within single major version: 0.21.0, 0.21.1, 0.21.x). Internal layout may change without notice, while our C++ api do not isolate this. Alternatively, use LibRaw C API, that provides such isolation. |
Just looked into raw.imageio/rawinput.cpp, read_native_scanline (HEAD/master fetched from github) The issue is solved: But raw_image is actual for Bayer images only, while Sony YCC/Pseudo-RAW is 3-color image, so color3_image or color4_image will be used: https://www.libraw.org/docs/API-datastruct-eng.html#libraw_rawdata_t So, please update OpenImageIO to support 3/4 color images. |
We're closing in on releasing 3.0 (which is currently still called "2.6" in the master branch), and 2.5 is the supported release family. So 2.4 is 2 years old and we're no longer investigating problems in it. We haven't issued any patches for 2.4 for quite some time now, and since that predated any 2024 era libraw releases or snapshots, I would consider that untested and not a combination I would recommend. I see now, 0.21.2 dates from January, so that is not the snapshot and thus doesn't contain support for the format in question. The new snapshot would be labelled 0.22.x, right? We do CI test against libraw master nightly, in addition to tagged releases, so I am confident that we build and run against your latest snapshots. |
@antond-weta Calling your attention to @LibRaw's comments above about Bayer images, since you seem to be currently working in our libraw code. |
Thanks for the investigation guys |
@lgritz Our snapshots are carefully tested against normal user case (no specifically crafted files e.g. from fuzzers, but normal files from user cameras). These snapshots are published as master branch and not tagged (it does not make sense, see below). So, LibRaw/master is generally OK for end-user cases: no unknown data sources (e.g. fuzzed/specially crafted files) just files from user's camera. It is not recommended to use in services opened to everyone (e.g. processing anonymous users uploads). |
BTW, null pointer access is a good reason for an immediate fix (and CVE) |
We CI test against a range of libraw releases, as well as whatever the current master is. But we don't supply pre-built binaries, nor strictly dictate what version of libraw that users/builders compile against (other than enforcing a minimum version, which is currently 0.18 in OIIO 2.5 but in our master was recently raised to 0.20). The judgment about which version of LibRaw to build against, or any feature vs reliability tradeoffs in that decision, is up to the downstream builder of OIIO. I think most of them just use whatever is the latest tagged release provided by their OS or packaging system of choice. So in general, I would only expect the latest snapshots to be used by people who make a proactive decision to build them from source and understand the tradeoffs. |
@LibRaw I really appreciate your input here, thanks. |
This null-pointer-access problem is not Sony/YCC specific. Such files will be processed OK in LibRaw part and will fail on null-pointer access in OIIO layer. |
Understood, thanks. |
I'll take a look, thanks! |
This adds a null pointer check in the raw input plugin when the user requested raw bayer data for a file format which doesn't have it. With this fix OIIO shows an error instead of crashing in such case. This fixes the issue mentioned in the comments of #4361. The title issue of #4361 has been resolved in LibRaw 0.22.0, so we can close that issue, I guess. This also fixes the crash on 5 out of 6 examples in #3115. The last one is unrelated, and I don't have a good fix for that at this time (crash due to the raw buffer having half resolution, with the pixel aspect ratio of 0.5). Perhaps we could create a separate issue and close #3115. I have not added any tests for this change specifically, as it is fairly trivial. I have started working on a more comprehensive test suite for the raw plugin / rawtoaces, but it's not ready yet, and I'm not sure where it should live at this stage. Signed-off-by: Anton Dukhovnikov <[email protected]>
…tion#4448) This adds a null pointer check in the raw input plugin when the user requested raw bayer data for a file format which doesn't have it. With this fix OIIO shows an error instead of crashing in such case. This fixes the issue mentioned in the comments of AcademySoftwareFoundation#4361. The title issue of AcademySoftwareFoundation#4361 has been resolved in LibRaw 0.22.0, so we can close that issue, I guess. This also fixes the crash on 5 out of 6 examples in AcademySoftwareFoundation#3115. The last one is unrelated, and I don't have a good fix for that at this time (crash due to the raw buffer having half resolution, with the pixel aspect ratio of 0.5). Perhaps we could create a separate issue and close AcademySoftwareFoundation#3115. I have not added any tests for this change specifically, as it is fairly trivial. I have started working on a more comprehensive test suite for the raw plugin / rawtoaces, but it's not ready yet, and I'm not sure where it should live at this stage. Signed-off-by: Anton Dukhovnikov <[email protected]>
Describe the bug
Importing a Sony ARW Medium or Small compression file with 15 bits per sample is unsupported in OIIO.
Other Sony ARW Medium or Small compression files which are not 15 bits per sample open correctly and are supported.
OpenImageIO version and dependencies
To Reproduce
Steps to reproduce the behavior:
Evidence
https://www.dropbox.com/scl/fi/y19jqq4q3rh1wv7810048/A1A04973.ARW?rlkey=pnrdm0oo0hlpbkep1goczk1da&st=ij4br4bn&dl=0
The text was updated successfully, but these errors were encountered: