dia: 0.97.3.20170622 -> unstable-2022-12-14

+148 -40
-11
pkgs/applications/graphics/dia/CVE-2019-19451.patch
··· 1 - diff -ru a/app/app_procs.c b/app/app_procs.c 2 - --- a/app/app_procs.c 2021-01-30 11:09:52.000000000 -0500 3 - +++ b/app/app_procs.c 2021-01-30 11:11:05.000000000 -0500 4 - @@ -785,6 +785,7 @@ 5 - 6 - if (!filename) { 7 - g_print (_("Filename conversion failed: %s\n"), filenames[i]); 8 - + ++i; 9 - continue; 10 - } 11 -
+54 -26
pkgs/applications/graphics/dia/default.nix
··· 1 - { lib, stdenv, fetchgit, autoconf, automake, libtool, gtk2, pkg-config, perlPackages, 2 - libxml2, gettext, python2, libxml2Python, docbook5, docbook_xsl, 3 - libxslt, intltool, libart_lgpl, withGNOME ? false, libgnomeui, 4 - gtk-mac-integration-gtk2 }: 1 + { lib 2 + , stdenv 3 + , fetchFromGitLab 4 + , appstream-glib 5 + , cmake 6 + , dblatex 7 + , desktop-file-utils 8 + , graphene 9 + , gtk2 10 + , gtk-mac-integration-gtk2 11 + , intltool 12 + , libxml2 13 + , libxslt 14 + , meson 15 + , ninja 16 + , pkg-config 17 + , poppler 18 + , python3 19 + # Building with docs are failing in unstable-2022-12-14 20 + , withDocs ? false 21 + }: 5 22 6 23 stdenv.mkDerivation { 7 24 pname = "dia"; 8 - version = "0.97.3.20170622"; 25 + version = "unstable-2022-12-14"; 9 26 10 - src = fetchgit { 11 - url = "https://gitlab.gnome.org/GNOME/dia.git"; 12 - rev = "b86085dfe2b048a2d37d587adf8ceba6fb8bc43c"; 13 - sha256 = "1fyxfrzdcs6blxhkw3bcgkksaf3byrsj4cbyrqgb4869k3ynap96"; 27 + src = fetchFromGitLab { 28 + owner = "GNOME"; 29 + repo = "dia"; 30 + domain = "gitlab.gnome.org"; 31 + rev = "4a619ec7cc93be5ddfbcc48d9e1572d04943bcad"; 32 + hash = "sha256-xi45Ak4rlDQjs/FNkdkm145mx76GNHjE6Nrs1dc94ww="; 14 33 }; 15 34 16 - patches = [ 17 - ./CVE-2019-19451.patch 18 - ]; 19 - 20 - buildInputs = 21 - [ gtk2 libxml2 gettext python2 libxml2Python docbook5 22 - libxslt docbook_xsl libart_lgpl ] 23 - ++ lib.optional withGNOME libgnomeui 24 - ++ lib.optional stdenv.isDarwin gtk-mac-integration-gtk2; 25 - 26 - nativeBuildInputs = [ autoconf automake libtool pkg-config intltool ] 27 - ++ (with perlPackages; [ perl XMLParser ]); 35 + patches = [ ./poppler-22_09-build-fix.patch ]; 28 36 29 37 preConfigure = '' 30 - NOCONFIGURE=1 ./autogen.sh # autoreconfHook is not enough 38 + patchShebangs . 31 39 ''; 32 - configureFlags = lib.optional withGNOME "--enable-gnome"; 33 40 34 - # error: implicitly declaring library function 'finite' with type 'int (double)' 35 - NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) "-Dfinite=isfinite"; 41 + buildInputs = [ 42 + graphene 43 + gtk2 44 + libxml2 45 + python3 46 + poppler 47 + ] ++ 48 + lib.optionals withDocs [ 49 + libxslt 50 + ] ++ 51 + lib.optionals stdenv.isDarwin [ 52 + gtk-mac-integration-gtk2 53 + ]; 36 54 37 - hardeningDisable = [ "format" ]; 55 + nativeBuildInputs = [ 56 + appstream-glib 57 + desktop-file-utils 58 + intltool 59 + meson 60 + ninja 61 + pkg-config 62 + ] ++ 63 + lib.optionals withDocs [ 64 + dblatex 65 + ]; 38 66 39 67 meta = with lib; { 40 68 description = "Gnome Diagram drawing software";
+93
pkgs/applications/graphics/dia/poppler-22_09-build-fix.patch
··· 1 + diff --git a/plug-ins/pdf/pdf-import.cpp b/plug-ins/pdf/pdf-import.cpp 2 + index 189737908..a2a479693 100644 3 + --- a/plug-ins/pdf/pdf-import.cpp 4 + +++ b/plug-ins/pdf/pdf-import.cpp 5 + @@ -152,12 +152,12 @@ public : 6 + void 7 + updateLineDash (GfxState *state) 8 + { 9 + - double *dashPattern; 10 + - int dashLength; 11 + - double dashStart; 12 + - 13 + - state->getLineDash (&dashPattern, &dashLength, &dashStart); 14 + - this->dash_length = dashLength ? dashPattern[0] * scale : 1.0; 15 + + const double *dashPattern=NULL; 16 + + int dashLength=0; 17 + + double dashStart=0; 18 + + const std::vector<double> &dash = state->getLineDash(&dashStart); // > Poppler 22.09 ... 19 + + dashPattern = dash.data(); 20 + + dashLength = dash.size(); 21 + 22 + if (dashLength == 0) 23 + this->line_style = DIA_LINE_STYLE_SOLID; 24 + @@ -318,10 +318,11 @@ public : 25 + //FIXME: Dia is really unhappy about zero size fonts 26 + if (!(state->getFontSize() > 0.0)) 27 + return; 28 + - GfxFont *f = state->getFont(); 29 + + const std::shared_ptr<GfxFont> f = state->getFont(); // poppler 22.05 ... header changed 30 + + gconstpointer f1 = &f; // GLib typedef const void * gconstpointer; 31 + 32 + // instead of building the same font over and over again 33 + - if (g_hash_table_lookup (this->font_map, f)) { 34 + + if (g_hash_table_lookup (this->font_map, f1)) { 35 + ++font_map_hits; 36 + return; 37 + } 38 + @@ -333,8 +334,9 @@ public : 39 + gchar *family = g_strdup (f->getFamily() ? f->getFamily()->c_str() : "sans"); 40 + 41 + // we are (not anymore) building the same font over and over again 42 + + f1 = &f; 43 + g_print ("Font 0x%x: '%s' size=%g (* %g)\n", 44 + - GPOINTER_TO_INT (f), family, state->getTransformedFontSize(), scale); 45 + + GPOINTER_TO_INT (f1), family, state->getTransformedFontSize(), scale); 46 + 47 + // now try to make a fontname Dia/Pango can cope with 48 + // strip style postfix - we already have extracted the style bits above 49 + @@ -354,7 +356,9 @@ public : 50 + fsize *= fabs(fm[3] / fm[0]); 51 + font = dia_font_new (family, style, fsize * scale / 0.8); 52 + 53 + - g_hash_table_insert (this->font_map, f, font); 54 + + f1 = &f; 55 + + gpointer f2 = (gpointer)f1; // GLib typedef void* gpointer; 56 + + g_hash_table_insert (this->font_map, f2, font); 57 + g_free (family); 58 + } 59 + void updateTextShift(GfxState *state, double shift) 60 + @@ -721,11 +725,12 @@ DiaOutputDev::drawString(GfxState *state, GooString *s) 61 + return; 62 + if (!(state->getFontSize() > 0.0)) 63 + return; 64 + - font = (DiaFont *)g_hash_table_lookup (this->font_map, state->getFont()); 65 + + gconstpointer f_1 = &state->getFont(); 66 + + font = (DiaFont *)g_hash_table_lookup (this->font_map, f_1); 67 + 68 + // we have to decode the string data first 69 + { 70 + - GfxFont *f = state->getFont(); 71 + + const std::shared_ptr<GfxFont> f = state->getFont(); 72 + const char *p = s->c_str(); 73 + CharCode code; 74 + int j = 0, m, n; 75 + @@ -870,8 +875,8 @@ import_pdf(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_ 76 + std::unique_ptr<PDFDoc> doc; 77 + GooString *fileName = new GooString(filename); 78 + // no passwords yet 79 + - GooString *ownerPW = NULL; 80 + - GooString *userPW = NULL; 81 + + const std::optional<GooString> ownerPW; 82 + + const std::optional<GooString> userPW; 83 + gboolean ret = FALSE; 84 + 85 + // without this we will get strange crashes (at least with /O2 build) 86 + @@ -899,6 +904,7 @@ import_pdf(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_ 87 + delete diaOut; 88 + ret = TRUE; 89 + } 90 + + doc.reset(); 91 + delete fileName; 92 + 93 + return ret;
+1 -3
pkgs/top-level/all-packages.nix
··· 28326 28326 28327 28327 dht = callPackage ../applications/networking/p2p/dht { }; 28328 28328 28329 - dia = callPackage ../applications/graphics/dia { 28330 - inherit (gnome2) libart_lgpl libgnomeui; 28331 - }; 28329 + dia = callPackage ../applications/graphics/dia { }; 28332 28330 28333 28331 direwolf = callPackage ../applications/radio/direwolf { 28334 28332 hamlib = hamlib_4;