Closed Thanatomanic closed 2 years ago
Here's a quick and very dirty patch to avoid the segfault. It's not meant to be committed, but as a starting point for a better patch.
diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc
index ef0b4e8dc..e631d4828 100644
--- a/rtengine/dcraw.cc
+++ b/rtengine/dcraw.cc
@@ -4397,6 +4397,11 @@ void CLASS crop_masked_pixels()
}
}
} else {
+ // dirty hack to show what's wrong and avoid segfault
+ if (height == 3510 && width == 5248 && !strncmp(model, "EOS R5", 6)) {
+ top_margin = 0;
+ left_margin = 0;
+ }
#ifdef _OPENMP
#pragma omp parallel for
#endif
Maybe another dev ( @Thanatomanic ) can make a more correct patch.
Ingo
The main issue is that our camconst.json
format can only handle one particular raw crop per camera, whereas this camera (and others like it) can have multiple depending on a shooting mode. The smaller raw image sizes are read correctly by dcraw
, but the crop values in camconst
indicate a bigger file, so too much memory is being read leading to the segfault. The actual segfault happens in this function https://github.com/Beep6581/RawTherapee/blob/166538dbcbb45ca86b3258b8615974ba2b8cee87/rtengine/dcraw.cc#L4371
I don't think we should be casually hacking that. A slightly better workaround may be similar to this https://github.com/Beep6581/RawTherapee/issues/6255
To be continued...
For reference, @agriggio has implemented raw size-dependent crops: https://bitbucket.org/agriggio/art/commits/c8df72cfd2b0c15fda1f5d5c3c5364161daff1bc
I like how Alberto adopted my style for writing lambdas. :sunglasses:
I guess same problem with CR3 raw files from Canon EOS R and 1.6 crop mode. log.txt current git 'dev' branch
Same problem with Canon EOS R6 (#6330).
I did some hacking. Here's a first result. Still needs some work.
See here for the original report: https://discuss.pixls.us/t/canon-r5-cropped-raws/25441
This file does not decode, but instead segfaults R5__0596.ZIP. It is shot as a lossy compressed cRAW in APS-C mode with a crop factor applied. ExifTool tells me:
There are two issues at play.
In any case, it shouldn't segfault.