On attempting to open this image (or any other from this camera, a Bushnell trail camera c.a. 2010 -- I don't have the exact model to hand):
RawTherapee crashes with the following error:
*** stack smashing detected ***: terminated
Aborted (core dumped)
while it's quite possible that the files are in some way non-conformant (though gwenview and gimp both read & display them without complaint) crashing with a distinctly terse error message is not perhaps the most elegant way of handling the problem.
The thumbnails for the images are displayed correctly, and other Jpegs are opened successfully.
Running rawtherapee 5.8 on Manjaro, from the repositories.
Here's a patch:
diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc
index be7a28a5c..e360e4a4e 100644
--- a/rtexif/stdattribs.cc
+++ b/rtexif/stdattribs.cc
@@ -384,13 +384,13 @@ public:
ShutterSpeedInterpreter () {}
std::string toString (const Tag* t) const override
{
- char buffer[32];
+ char buffer[32] = {};
double d = pow (2.0, -t->toDouble());
if (d > 0.0 && d <= 0.5) {
- sprintf (buffer, "1/%.0f", 1.0 / d);
+ snprintf (buffer, sizeof(buffer) - 1, "1/%.0f", 1.0 / d);
} else {
- sprintf (buffer, "%.1f", d);
+ snprintf (buffer, sizeof(buffer) - 1, "%.1f", d);
}
return buffer;
@heckflosse Does this compile on your Windows setup?
diff --git a/rtengine/utils.cc b/rtengine/utils.cc
index 0674c9806..51db711a8 100644
--- a/rtengine/utils.cc
+++ b/rtengine/utils.cc
@@ -263,6 +263,19 @@ void swab(const void* from, void* to, ssize_t n)
}
}
+std::string stringprintf(const char* format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ char* c_str;
+ vasprintf(&c_str, format, args);
+ std::string str(c_str);
+ free(c_str);
+ va_end(args);
+
+ return str;
+}
+
}
#if __SIZEOF_WCHAR_T__ == 4
diff --git a/rtengine/utils.h b/rtengine/utils.h
index e0097d76e..48647b1ea 100644
--- a/rtengine/utils.h
+++ b/rtengine/utils.h
@@ -18,6 +18,7 @@
*/
#pragma once
+#include <string>
#include <type_traits>
#include <glibmm/ustring.h>
@@ -54,6 +55,8 @@ bool hasPngExtension(const Glib::ustring& filename);
void swab(const void* from, void* to, ssize_t n);
+std::string stringprintf(const char* format, ...) __attribute__((format(printf, 1, 2)));
+
}
#if __SIZEOF_WCHAR_T__ == 4
@Floessie
It does not:
[ 6%] Building CXX object rtengine/CMakeFiles/rtengine.dir/utils.cc.obj
Z:/H2/rt59/rtengine/utils.cc: In function 'std::string rtengine::stringprintf(const char*, ...)':
Z:/H2/rt59/rtengine/utils.cc:271:8: error: 'vasprintf' was not declared in this scope; did you mean 'vsprintf'?
271 | vasprintf(&c_str, format, args);
| ^~~~~~~~~
| vsprintf
@heckflosse If your time permits, would you please check the snprintf branch?
@Floessie Compiling :+1:
@Floessie Compiles fine, but has some random effects when opening images which I will try to reproduce now...
@heckflosse Thanks for testing! :+1: I'm AFK now...
@Floessie
When you'r BTK, please have a look at this:
https://github.com/Beep6581/RawTherapee/commit/79278875da80bc918b113ac2bdf98aa1a4e2c359#diff-455632078b82ee0070410388030aaf6cR1050
Pushed some fixes.
Shall I merge?
I could not reproduce the random effects I mentioned above. So :+1: from me for merge
Done with 604823fc4b6fe81de2e89b0ffed4e0db00c63b63.