diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e01e4bd75..bdcd98c1c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -98,6 +98,10 @@ jobs: run: | echo "Listing shared library dependencies." ldd "./build/${{matrix.build_type}}/rawtherapee.exe" + echo "Finding DLLs to include." + DLLS=($(ldd "./build/${{matrix.build_type}}/rawtherapee.exe" | grep '/mingw64/bin/' | awk '{print($1)'})) + echo "Required DLLs are: ${DLLS[*]}" + echo "Getting workspace path." export BUILD_DIR="$(pwd)/build/${{matrix.build_type}}" echo "Build directory is '$BUILD_DIR'." @@ -110,68 +114,7 @@ jobs: "gdbus.exe" \ "gspawn-win64-helper.exe" \ "gspawn-win64-helper-console.exe" \ - "libatk-1.0-0.dll" \ - "libatkmm-1.6-1.dll" \ - "libbrotlicommon.dll" \ - "libbrotlidec.dll" \ - "libbz2-1.dll" \ - "libcairo-2.dll" \ - "libcairo-gobject-2.dll" \ - "libcairomm-1.0-1.dll" \ - "libdatrie-1.dll" \ - "libdeflate.dll" \ - "libepoxy-0.dll" \ - "libexpat-1.dll" \ - libffi-*.dll \ - "libfftw3f-3.dll" \ - "libfftw3f_omp-3.dll" \ - "libfontconfig-1.dll" \ - "libfreetype-6.dll" \ - "libfribidi-0.dll" \ - "libgcc_s_seh-1.dll" \ - "libgdk_pixbuf-2.0-0.dll" \ - "libgdk-3-0.dll" \ - "libgdkmm-3.0-1.dll" \ - "libgio-2.0-0.dll" \ - "libgiomm-2.4-1.dll" \ - "libglib-2.0-0.dll" \ - "libglibmm-2.4-1.dll" \ - "libgmodule-2.0-0.dll" \ - "libgobject-2.0-0.dll" \ - "libgomp-1.dll" \ - "libgraphite2.dll" \ - "libgtk-3-0.dll" \ - "libgtkmm-3.0-1.dll" \ - "libharfbuzz-0.dll" \ - "libiconv-2.dll" \ - "libintl-8.dll" \ - "libjbig-0.dll" \ - "libjpeg-8.dll" \ - "liblcms2-2.dll" \ - "liblensfun.dll" \ - "libLerc.dll" \ - "liblzma-5.dll" \ - "libpango-1.0-0.dll" \ - "libpangocairo-1.0-0.dll" \ - "libpangoft2-1.0-0.dll" \ - "libpangomm-1.4-1.dll" \ - "libpangowin32-1.0-0.dll" \ - "libpcre2-8-0.dll" \ - "libpixman-1-0.dll" \ - "libpng16-16.dll" \ - "librsvg-2-2.dll" \ - "libsharpyuv-0.dll" \ - "libsigc-2.0-0.dll" \ - "libstdc++-6.dll" \ - "libsystre-0.dll" \ - "libthai-0.dll" \ - "libtiff-6.dll" \ - "libtre-5.dll" \ - "libwebp-7.dll" \ - "libwinpthread-1.dll" \ - "libxml2-2.dll" \ - "libzstd.dll" \ - "zlib1.dll" \ + ${DLLS[*]} \ "$BUILD_DIR" cd - diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 352dc26e1..c4bf9b14a 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1259,10 +1259,10 @@ Camera constants: }, { // Quality C - "make_model": "Canon EOS R6m2", + "make_model": ["Canon EOS R6m2", "Canon EOS R8"], "dcraw_matrix": [9539, -2795, -1224, -4175, 11998, 2458, -465, 1755, 6048], "raw_crop": [ - {"frame": [6188, 4120], "crop": [154, 96, 6028, 4024]}, + {"frame": [6188, 4120], "crop": [154, 96, 6024, 4024]}, {"frame": [3936, 2612], "crop": [156, 96, 3780, 2516]} ], "masked_areas": [ diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index ef71002a6..c7bcfc910 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -9807,9 +9807,9 @@ void CLASS identify() if (!strncasecmp (model, make, i) && model[i++] == ' ') memmove (model, model+i, 64-i); if (!strncmp (model,"FinePix ",8)) - strcpy (model, model+8); +/* RT */ memmove (model, model+8, 64-8); if (!strncmp (model,"Digital Camera ",15)) - strcpy (model, model+15); +/* RT */ memmove (model, model+15, 64-15); desc[511] = artist[63] = make[63] = model[63] = model2[63] = 0; if (!is_raw) goto notraw; diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index e44243fd3..06d5a4b0c 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -455,6 +455,8 @@ public: if (loadAll) { loadProfiles(profilesDir, &fileProfiles, &fileProfileContents, nullptr, false); loadProfiles(userICCDir, &fileProfiles, &fileProfileContents, nullptr, false); + Glib::ustring user_output_icc_dir = Glib::build_filename(options.rtdir, "iccprofiles", "output"); + loadProfiles(user_output_icc_dir, &fileProfiles, &fileProfileContents, nullptr, false); } // Input profiles diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index ad230bb7d..31c97aeb8 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -1033,7 +1033,7 @@ int ImageIO::savePNG (const Glib::ustring &fname, int bps) const #if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED) png_set_option(png, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON); #endif - + png_infop info = png_create_info_struct(png); if (!info) { @@ -1232,25 +1232,34 @@ int ImageIO::saveJPEG (const Glib::ustring &fname, int quality, int subSamp) con jpeg_start_compress(&cinfo, TRUE); - // buffer for exif and iptc markers - unsigned char* buffer = new unsigned char[165535]; //FIXME: no buffer size check so it can be overflowed in createJPEGMarker() for large tags, and then software will crash - unsigned int size; + // buffer for exif marker + unsigned char* exifBuffer = nullptr; + unsigned int exifBufferSize = 0; // assemble and write exif marker if (exifRoot) { - int size = rtexif::ExifManager::createJPEGMarker (exifRoot, *exifChange, cinfo.image_width, cinfo.image_height, buffer); + rtexif::ExifManager::createJPEGMarker (exifRoot, *exifChange, cinfo.image_width, cinfo.image_height, exifBuffer, exifBufferSize); - if (size > 0 && size < 65530) { - jpeg_write_marker(&cinfo, JPEG_APP0 + 1, buffer, size); + if (exifBufferSize > 0 && exifBufferSize < 65530) { + jpeg_write_marker(&cinfo, JPEG_APP0 + 1, exifBuffer, exifBufferSize); } + } + if (exifBuffer != nullptr) { + delete [] exifBuffer; + } + + // buffer for iptc marker + unsigned char* iptcBuffer = new unsigned char[65535]; + // assemble and write iptc marker if (iptc) { unsigned char* iptcdata; + unsigned int iptcSize; bool error = false; - if (iptc_data_save (iptc, &iptcdata, &size)) { + if (iptc_data_save (iptc, &iptcdata, &iptcSize)) { if (iptcdata) { iptc_data_free_buf (iptc, iptcdata); } @@ -1260,7 +1269,7 @@ int ImageIO::saveJPEG (const Glib::ustring &fname, int quality, int subSamp) con int bytes = 0; - if (!error && (bytes = iptc_jpeg_ps3_save_iptc (nullptr, 0, iptcdata, size, buffer, 65532)) < 0) { + if (!error && (bytes = iptc_jpeg_ps3_save_iptc (nullptr, 0, iptcdata, iptcSize, iptcBuffer, 65532)) < 0) { error = true; } @@ -1269,11 +1278,11 @@ int ImageIO::saveJPEG (const Glib::ustring &fname, int quality, int subSamp) con } if (!error) { - jpeg_write_marker(&cinfo, JPEG_APP0 + 13, buffer, bytes); + jpeg_write_marker(&cinfo, JPEG_APP0 + 13, iptcBuffer, bytes); } } - delete [] buffer; + delete [] iptcBuffer; // write icc profile to the output if (profileData) { diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index e58c38faa..6db6b7627 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -18245,9 +18245,9 @@ void ImProcFunctions::Lab_Local( #endif for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { - tmpImageorig->r(y, x) = intp(lp.opacol, screen(tmpImageorig->r(y, x), tmpImagereserv->r(y, x), maxR), tmpImageorig->r(y, x)); - tmpImageorig->g(y, x) = intp(lp.opacol, screen(tmpImageorig->g(y, x), tmpImagereserv->g(y, x), maxG), tmpImageorig->g(y, x)); - tmpImageorig->b(y, x) = intp(lp.opacol, screen(tmpImageorig->b(y, x), tmpImagereserv->b(y, x), maxB), tmpImageorig->b(y, x)); + tmpImageorig->r(y, x) = intp(lp.opacol, screen(tmpImageorig->r(y, x), tmpImagereserv->r(y, x), 1.f), tmpImageorig->r(y, x)); + tmpImageorig->g(y, x) = intp(lp.opacol, screen(tmpImageorig->g(y, x), tmpImagereserv->g(y, x), 1.f), tmpImageorig->g(y, x)); + tmpImageorig->b(y, x) = intp(lp.opacol, screen(tmpImageorig->b(y, x), tmpImagereserv->b(y, x), 1.f), tmpImageorig->b(y, x)); } } } else if (lp.mergecolMethod == 12) { //darken only diff --git a/rtengine/pdaflinesfilter.cc b/rtengine/pdaflinesfilter.cc index b5c72f7f4..60f2abcb6 100644 --- a/rtengine/pdaflinesfilter.cc +++ b/rtengine/pdaflinesfilter.cc @@ -275,7 +275,11 @@ int PDAFLinesFilter::mark(const array2D &rawData, PixelsMap &bpMap) for (int y = 1; y < H_-1; ++y) { int yy = pattern_[idx] + off; if (y == yy) { - int n = markLine(rawData, bpMap, y) + markLine(rawData, bpMap, y-1) + markLine(rawData, bpMap, y+1); + int n = 0; + n += markLine(rawData, bpMap, y); + n += (y-1 <= 0 ) ? 0 : markLine(rawData, bpMap, y-1); + n += (y+1 >= H_-1) ? 0 : markLine(rawData, bpMap, y+1); + if (n) { found += n; if (settings->verbose) { diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index a7125fb9a..68a290eb6 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -1209,6 +1209,10 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) goto defsubdirs; } } else { + // In some circumstances, `value` may have been allocated, so + // delete it to prevent a leak. See issue + // https://github.com/Beep6581/RawTherapee/issues/6735 + delete [] value; // read value value = new unsigned char [valuesize + 1]; auto readSize = fread (value, 1, valuesize, f); @@ -3243,24 +3247,17 @@ std::vector ExifManager::getDefaultTIFFTags (TagDirectory* forthis) -int ExifManager::createJPEGMarker (const TagDirectory* root, const rtengine::procparams::ExifPairs& changeList, int W, int H, unsigned char* buffer) +void ExifManager::createJPEGMarker (const TagDirectory* root, const rtengine::procparams::ExifPairs& changeList, int W, int H, unsigned char *&buffer, unsigned &bufferSize) { // write tiff header - int offs = 6; - memcpy (buffer, "Exif\0\0", 6); + int offs = 6; // "Exif\0\0" ByteOrder order = INTEL; if (root) { order = root->getOrder (); } - sset2 ((unsigned short)order, buffer + offs, order); - offs += 2; - sset2 (42, buffer + offs, order); - offs += 2; - sset4 (8, buffer + offs, order); - TagDirectory* cl; if (root) { @@ -3322,11 +3319,18 @@ int ExifManager::createJPEGMarker (const TagDirectory* root, const rtengine::pro } cl->sort (); - int size = cl->write (8, buffer + 6); + bufferSize = cl->calculateSize() + 8 + 6; + buffer = new unsigned char[bufferSize]; // this has to be deleted in caller + memcpy (buffer, "Exif\0\0", 6); + sset2 ((unsigned short)order, buffer + offs, order); + offs += 2; + sset2 (42, buffer + offs, order); + offs += 2; + sset4 (8, buffer + offs, order); + + cl->write (8, buffer + 6); delete cl; - - return size + 6; } int ExifManager::createPNGMarker(const TagDirectory* root, const rtengine::procparams::ExifPairs &changeList, int W, int H, int bps, const char* iptcdata, int iptclen, unsigned char *&buffer, unsigned &bufferSize) diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 7b2f8ad23..0b44bc47a 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -379,7 +379,7 @@ public: /// @param forthis The byte order will be taken from the given directory. /// @return The ownership of the return tags is passed to the caller. static std::vector getDefaultTIFFTags (TagDirectory* forthis); - static int createJPEGMarker (const TagDirectory* root, const rtengine::procparams::ExifPairs& changeList, int W, int H, unsigned char* buffer); + static void createJPEGMarker (const TagDirectory* root, const rtengine::procparams::ExifPairs& changeList, int W, int H, unsigned char *&buffer, unsigned &bufferSize); static int createTIFFHeader (const TagDirectory* root, const rtengine::procparams::ExifPairs& changeList, int W, int H, int bps, const char* profiledata, int profilelen, const char* iptcdata, int iptclen, unsigned char *&buffer, unsigned &bufferSize); static int createPNGMarker(const TagDirectory *root, const rtengine::procparams::ExifPairs &changeList, int W, int H, int bps, const char *iptcdata, int iptclen, unsigned char *&buffer, unsigned &bufferSize); }; diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index 6db30bb14..46899f1a2 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -47,6 +47,11 @@ ToolParamBlock::ToolParamBlock() { //GTK318 } +Gtk::SizeRequestMode ToolParamBlock::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; +} + FoldableToolPanel::FoldableToolPanel(Gtk::Box* content, Glib::ustring toolName, Glib::ustring UILabel, bool need11, bool useEnabled) : ToolPanel(toolName, need11), parentContainer(nullptr), exp(nullptr), lastEnabled(true) { if (!content) { diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index 5ec59c9c2..f22f6f771 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -70,6 +70,7 @@ class ToolParamBlock : { public: ToolParamBlock(); + Gtk::SizeRequestMode get_request_mode_vfunc () const override; }; class ToolPanel : diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index 876d35e3a..2faa69f83 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -73,6 +73,8 @@ arw CR2 cr2 + CR3 + cr3 CRF crf CRW