Sebastian Kraft schrieb am 16.07.2016 um 12:45:
> On 16.07.2016 00:44, Hartmut Knaack wrote:
>> Appearance
>> ==========
>> In my test case, ufraw crashes with the message "Segmentation fault (core 
>> dumped)", when I open a Raw image of a camera which is unsupported by 
>> lensfun, and select in the lens correction tab the model "PanoTools Lens 
>> Model".
>>
> 
> Thanks for your report.
> 
>> Details
>> =======
>> By debugging lfModifier::lfModifier I figured that crop is set to zero by 
>> ufraw in case that no lensfun profile exists for the specific camera.
> 
> I don't understand why ufraw tries to run the lfModifier if there is no 
> lensfun profile or crop factor available? Both are essential to get any 
> meaningful output from the lfModifier.
> 

I would speculate that it allows people to manually adjusting those
distortion parameters to undistort images which don't have camera support
in lensfun, yet. At least it was working before 41fa7a.

> BTW: Is the *lens argument set to NULL in this case?

No. See these changes:
diff --git a/libs/lensfun/modifier.cpp b/libs/lensfun/modifier.cpp
index fbc4102..7659ced 100644
--- a/libs/lensfun/modifier.cpp
+++ b/libs/lensfun/modifier.cpp
@@ -201,6 +201,8 @@ lfModifier::lfModifier (const lfLens *lens, float crop, int 
width, int height)
     {
         calibration_cropfactor = lens->CropFactor;
         calibration_aspect_ratio = lens->AspectRatio;
+        g_print("lens is not NULL, calibration_cropfactor: %f, 
calibration_aspect_ratio: %f\n",
+               calibration_cropfactor, calibration_aspect_ratio);
     }
     else
         calibration_cropfactor = calibration_aspect_ratio = NAN;
@@ -230,6 +232,10 @@ lfModifier::lfModifier (const lfLens *lens, float crop, 
int width, int height)
     // Used for autoscaling
     MaxX = Width / 2.0 * NormScale;
     MaxY = Height / 2.0 * NormScale;
+    g_print("crop: %f, coordinate_correction: %f, NormScale: %f\n"
+           "NormUnScale: %f, CenterX: %f, CenterY: %f\n"
+           "MaxX: %f, MaxY: %f, NormalizedInMillimeters: %f\n", crop, 
coordinate_correction, NormScale,
+           NormUnScale, CenterX, CenterY, MaxX, MaxY, NormalizedInMillimeters);
 }
 
 static void free_callback_list (void *arr)

Resulting output:
lens is not NULL, calibration_cropfactor: 0,000000, calibration_aspect_ratio: 
0,000000
crop: 0,000000, coordinate_correction: -nan, NormScale: -nan
NormUnScale: -nan, CenterX: -nan, CenterY: -nan
MaxX: -nan, MaxY: -nan, NormalizedInMillimeters: inf

These messages appear multiple times after an image has been loaded.
Crashes occur immediately after selecting model "5th order polynomial" or
"PanoTools lens model". For "3rd order polynomial", it crashes after
changing k1.

> 
>> Suggested fix
>> =============
>> Check variables used as divisor for being non-zero before engaging a 
>> division. Either return an error condition or set the variable to a sane 
>> default value.
>>
> 
> Well, the question is what happens afterwards. If ufraw feeds a crop 
> factor of 0 without calibration data, what's the expected outcome?

Agreed, that ufraw may be providing invalid data. But this is a
situation you have to deal with in a library. I'm mainly concerned
about the segmentation fault occurring in later operations, which
should be avoided.

> 
> Sebastian
> 
> 
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are 
> consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
> J-Flow, sFlow and other flows. Make informed decisions using capacity planning
> reports.http://sdm.link/zohodev2dev
> _______________________________________________
> Lensfun-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/lensfun-users
> 


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Lensfun-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lensfun-users

Reply via email to