jiebi/CodeConvo huggingface dataset:
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) ([ (mkOverride "flask"       "0.10.1" "0wrkavjdjndknhp8ya8j850jq7a1cli4g5a93mg8nh1xz2gq50sc") (mkOverride "flask_login" "0.2.11" "1rg3rsjs1gwi2pw6vr9jmhaqm9b3vc9c4hfcsvp4y8agbh7g3mc3") <del> (mkOverride "jinja2"      "2.8.1"  "14aqmhkc9rw5w0v311jhixdm6ym8vsm29dhyxyrjfqxljwx1yd1m") </del> (mkOverride "pylru"       "1.0.9"  "0b0pq0l7xv83dfsajsc49jcxzc99kb9jfx1a1dlx22hzcy962dvi") (mkOverride "sarge"       "0.1.4"  "08s8896973bz1gg0pkr592w6g4p6v47bkfvws5i91p9xf8b35yar") (mkOverride "tornado"     "4.5.3"  "02jzd23l4r6fswmwxaica9ldlyc2p6q8dk6dyff7j58fmdzf853d") # https://github.com/NixOS/nixpkgs/pull/58179#issuecomment-478605134 (mkOverride "werkzeug"    "0.14.1" "c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c") <ins> # Octoprint holds back jinja2 to 2.8.1 due to breaking changes. # This old version does not have updated test config for pytest 4, # and pypi tarball doesn't contain tests dir anyways. (pself: psuper: { jinja2 = psuper.jinja2.overridePythonAttrs (oldAttrs: rec { version = "2.8.1"; src = oldAttrs.src.override { inherit version; sha256 = "14aqmhkc9rw5w0v311jhixdm6ym8vsm29dhyxyrjfqxljwx1yd1m"; }; doCheck = false; }); }) </ins> ]); };
description = '' Peers/devices which syncthing should communicate with. ''; <del> example = [ { name = "bigbox"; </del> <ins> example = { bigbox = { </ins> id = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU"; addresses = [ "tcp://192.168.0.10:51820" ]; <del> } ]; </del> <ins> }; }; </ins> type = types.attrsOf (types.submodule ({ config, ... }: { options = {
] # Never even try to use lchmod on linux, # don't rely on detecting glibc-isms. <del> ++ optional stdenv.hostPlatform.isLinux "ac_cv_func_lchmod=no"; </del> <ins> ++ optional stdenv.hostPlatform.isLinux "ac_cv_func_lchmod=no" ++ optional static "LDFLAGS=-static"; </ins> buildInputs = optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
stdenv.mkDerivation rec { pname = "proot"; <del> version = "5.1.0.20190305"; </del> <ins> version = "20190510"; </ins> src = fetchFromGitHub { repo = "proot"; owner = "proot-me"; <del> rev = "ff61c86cb26f71c06af22574d9d4cc3a77292781"; sha256 = "0qink34bjv0lshf3c8997w39r8yxgbhxpjbxw47l5xkvimlpc0dl"; </del> <ins> rev = "803e54d8a1b3d513108d3fc413ba6f7c80220b74"; sha256 = "0gwzqm5wpscj3fchlv3qggf3zzn0v00s4crb5ciwljan1zrqadhy"; </ins> }; postPatch = ''
deps = [ python ]; substitutions = { inherit waf; <del> crossFlags = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) </del> <ins> crossFlags = lib.optionalString (stdenv.hostPlatform.system != stdenv.targetPlatform.system) </ins> ''--cross-compile "--cross-execute=${stdenv.targetPlatform.emulator pkgs}"''; }; } ../development/tools/build-managers/waf/setup-hook.sh;
path = with pkgs; [ iptables ipset iproute systemd ]; postStart = '' <del> ${pkgs.ipset}/bin/ipset -quiet create -exist sshguard4 hash:ip family inet ${pkgs.ipset}/bin/ipset -quiet create -exist sshguard6 hash:ip family inet6 </del> ${pkgs.iptables}/bin/iptables  -I INPUT -m set --match-set sshguard4 src -j DROP ${pkgs.iptables}/bin/ip6tables -I INPUT -m set --match-set sshguard6 src -j DROP '';
"${ghostscript}/bin:" + (if aspell == null then "" else "${aspell}/bin:") + (if tex == null then "" else "${tex}/bin:") + <del> (if netpbm == null then "" else "${netpbm}/bin:") + </del> <ins> (if netpbm == null then "" else "${stdenv.lib.getBin netpbm}/bin:") + </ins> (if imagemagick == null then "" else "${imagemagick}/bin:"); enableParallelBuilding = true;
<del> { lib, stdenv, fetchsvn, pkgconfig, libjpeg, libpng, flex, zlib, perl, libxml2 , makeWrapper, libtiff , enableX11 ? false, libX11 }: </del> <ins> { lib , stdenv , fetchsvn , pkgconfig , libjpeg , libpng , flex , zlib , perl , libxml2 , makeWrapper , libtiff , enableX11 ? false , libX11 }: </ins> stdenv.mkDerivation { # Determine version and revision from: # https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced <del> name = "netpbm-10.82.01"; </del> <ins> name = "netpbm-10.89.1"; outputs = [ "bin" "out" "dev" ]; </ins> src = fetchsvn { url = "https://svn.code.sf.net/p/netpbm/code/advanced"; <del> rev = "3264"; sha256 = "17fmyjbxp1l18rma7gb0m8wd9kx2iwhqs8dd6fpalsn2cr8mf8hf"; </del> <ins> rev = "3735"; sha256 = "hRepEUBlf83p77Amjze+Qz7XTHhCuPdV01K/UabR89Q="; </ins> }; <del> postPatch = /* CVE-2005-2471, from Arch */ '' substituteInPlace converter/other/pstopnm.c  --replace '"-dSAFER"' '"-dPARANOIDSAFER"' </del> <ins> postPatch = '' # Install libnetpbm.so symlink to correct destination substituteInPlace lib/Makefile  --replace '/sharedlink' '/lib' </ins> ''; <del> buildInputs = [ pkgconfig flex zlib perl libpng libjpeg libxml2 makeWrapper libtiff ] ++ lib.optional enableX11 libX11; </del> <ins> nativeBuildInputs = [ pkgconfig flex makeWrapper ]; buildInputs = [ zlib perl libpng libjpeg libxml2 libtiff ] ++ lib.optional enableX11 libX11; </ins> configurePhase = '' <ins> runHook preConfigure </ins> cp config.mk.in config.mk <del> echo "STATICLIB_TOO = n" >> config.mk substituteInPlace "config.mk"  --replace "TIFFLIB = NONE" "TIFFLIB = ${libtiff.out}/lib/libtiff.so"  --replace "TIFFHDR_DIR =" "TIFFHDR_DIR = ${libtiff.dev}/include"  --replace "JPEGLIB = NONE" "JPEGLIB = ${libjpeg.out}/lib/libjpeg.so"  --replace "JPEGHDR_DIR =" "JPEGHDR_DIR = ${libjpeg.dev}/include" '' + stdenv.lib.optionalString stdenv.isDarwin '' </del> <ins> # Disable building static library echo "STATICLIB_TOO = N" >> config.mk # Use libraries from Nixpkgs echo "TIFFLIB = libtiff.so" >> config.mk echo "TIFFLIB_NEEDS_JPEG = N" >> config.mk echo "TIFFLIB_NEEDS_Z = N" >> config.mk echo "JPEGLIB = libjpeg.so" >> config.mk # Fix path to rgb.txt echo "RGB_DB_PATH = $out/share/netpbm/misc/rgb.txt" >> config.mk '' + stdenv.lib.optionalString stdenv.isDarwin '' </ins> echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.$(MAJ).dylib" >> config.mk echo "NETPBMLIBTYPE = dylib" >> config.mk echo "NETPBMLIBSUFFIX = dylib" >> config.mk <del> ''; preBuild = '' export LDFLAGS="-lz" substituteInPlace "pm_config.in.h"  --subst-var-by "rgbPath1" "$out/lib/rgb.txt"  --subst-var-by "rgbPath2" "/var/empty/rgb.txt"  --subst-var-by "rgbPath3" "/var/empty/rgb.txt" touch lib/standardppmdfont.c </del> <ins> runHook postConfigure </ins> ''; <del> enableParallelBuilding = false; </del> <ins> enableParallelBuilding = true; </ins> installPhase = '' <ins> runHook preInstall </ins> make package pkgdir=$out <del> rm -rf $out/link $out/*_template $out/{pkginfo,README,VERSION} $out/man/web </del> <ins> rm -rf $out/*_template $out/{pkginfo,README,VERSION} $out/man/web </ins> mkdir -p $out/share/netpbm mv $out/misc $out/share/netpbm/
for prog in ppmquant; do wrapProgram "$out/bin/$prog" --prefix PATH : "$out/bin" done <ins> moveToOutput bin "''${!outputBin}" runHook postInstall </ins> ''; <ins> passthru.updateScript = ./update.sh; </ins> meta = { <del> homepage = http://netpbm.sourceforge.net/; </del> <ins> homepage = "http://netpbm.sourceforge.net/"; </ins> description = "Toolkit for manipulation of graphic images"; <del> license = "GPL,free"; </del> <ins> license = lib.licenses.free; # http://netpbm.svn.code.sourceforge.net/p/netpbm/code/trunk/doc/copyright_summary </ins> platforms = with stdenv.lib.platforms; linux ++ darwin; }; }
<ins> #!/usr/bin/env nix-shell #!nix-shell -p bash -p subversion -p common-updater-scripts -i bash die() { echo "error: $1" >&2 exit 1 } attr=netpbm svnRoot=https://svn.code.sf.net/p/netpbm/code/advanced oldRev=$(nix-instantiate --eval -E "with import ./. {}; $attr.src.rev" | tr -d '"') if [[ -z "$oldRev" ]]; then die "Could not extract old revision." fi latestRev=$(svn info --show-item "last-changed-revision" "$svnRoot") if [[ -z "$latestRev" ]]; then die "Could not find out last changed revision." fi versionInfo=$(svn cat -r "$latestRev" "$svnRoot/version.mk") if [[ -z "$versionInfo" ]]; then die "Could not get version info." fi nixFile=$(nix-instantiate --eval --strict -A "$attr.meta.position" | sed -re 's/^"(.*):[0-9]+"$/1/') if [[ ! -f "$nixFile" ]]; then die "Could not evaluate '$attr.meta.position' to locate the .nix file!" fi # h remembers if we found the pattern; on the last line, if a pattern was previously found, we exit with 1 # https://stackoverflow.com/a/12145797/160386 sed -i "$nixFile" -re '/(brevbs*=s*)"'"$oldRev"'"/{ s||1"'"$latestRev"'"|; h }; ${x; /./{x; q1}; x}' && die "Unable to update revision." majorRelease=$(grep --perl-regex --only-matching 'NETPBM_MAJOR_RELEASE = K.+' <<< "$versionInfo") minorRelease=$(grep --perl-regex --only-matching 'NETPBM_MINOR_RELEASE = K.+' <<< "$versionInfo") pointRelease=$(grep --perl-regex --only-matching 'NETPBM_POINT_RELEASE = K.+' <<< "$versionInfo") update-source-version "$attr" "$majorRelease.$minorRelease.$pointRelease" </ins>
preConfigure = '' rm cmake/FindNETPBM.cmake <del> echo "SET(NETPBM_LIBRARY `find ${netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake echo "SET(NETPBM_LIBRARIES `find ${netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake echo "SET(NETPBM_INCLUDE_DIR ${netpbm}/include/netpbm)" >> cmake/FindNETPBM.cmake </del> <ins> echo "SET(NETPBM_LIBRARY `find ${stdenv.lib.getLib netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake echo "SET(NETPBM_LIBRARIES `find ${stdenv.lib.getLib netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake echo "SET(NETPBM_INCLUDE_DIR ${stdenv.lib.getDev netpbm}/include/netpbm)" >> cmake/FindNETPBM.cmake </ins> echo "INCLUDE(FindPackageHandleStandardArgs)" >> cmake/FindNETPBM.cmake echo "FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETPBM DEFAULT_MSG NETPBM_LIBRARY NETPBM_INCLUDE_DIR)" >> cmake/FindNETPBM.cmake '';
sed -i src/form.c -e '21i#include <stdlib.h>' # there is no point to bring in the whole netpbm package just for this file <del> install -Dm644 ${netpbm}/share/netpbm/misc/rgb.txt $out/share/yad/rgb.txt </del> <ins> install -Dm644 ${netpbm.out}/share/netpbm/misc/rgb.txt $out/share/yad/rgb.txt </ins> ''; postAutoreconf = ''
--replace "psselect" "${psutils}/bin/psselect" '' + stdenv.lib.optionalString (netpbm != null) '' substituteInPlace src/preproc/html/pre-html.cpp  <del> --replace "pnmcut" "${netpbm}/bin/pnmcut"  --replace "pnmcrop" "${netpbm}/bin/pnmcrop"  --replace "pnmtopng" "${netpbm}/bin/pnmtopng" </del> <ins> --replace "pnmcut" "${stdenv.lib.getBin netpbm}/bin/pnmcut"  --replace "pnmcrop" "${stdenv.lib.getBin netpbm}/bin/pnmcrop"  --replace "pnmtopng" "${stdenv.lib.getBin netpbm}/bin/pnmtopng" </ins> substituteInPlace tmac/www.tmac  <del> --replace "pnmcrop" "${netpbm}/bin/pnmcrop"  --replace "pngtopnm" "${netpbm}/bin/pngtopnm"  --replace "@PNMTOPS_NOSETPAGE@" "${netpbm}/bin/pnmtops -nosetpage" </del> <ins> --replace "pnmcrop" "${stdenv.lib.getBin netpbm}/bin/pnmcrop"  --replace "pngtopnm" "${stdenv.lib.getBin netpbm}/bin/pngtopnm"  --replace "@PNMTOPS_NOSETPAGE@" "${stdenv.lib.getBin netpbm}/bin/pnmtops -nosetpage" </ins> ''; buildInputs = [ ghostscript psutils netpbm perl ];
checkInputs = [ sphinx numpydoc pytest ]; propagatedBuildInputs = [ python-lz4 ]; <del> # test_disk_used is broken # https://github.com/joblib/joblib/issues/57 </del> <ins> # test_disk_used is broken: https://github.com/joblib/joblib/issues/57 # test_dispatch_multiprocessing is broken only on Darwin. </ins> checkPhase = '' <del> py.test joblib -k "not test_disk_used" </del> <ins> py.test -k 'not test_disk_used${lib.optionalString (stdenv.isDarwin) " and not test_dispatch_multiprocessing"}' joblib/test </ins> ''; meta = {
, gtk, girara, gettext, libxml2, check , sqlite, glib, texlive, libintl, libseccomp , file, librsvg <del> , gtk-mac-integration, synctexSupport ? true </del> <ins> , gtk-mac-integration </ins> }: <del> assert synctexSupport -> texlive != null; </del> with stdenv.lib; stdenv.mkDerivation rec {
buildInputs = [ gtk girara libintl sqlite glib file librsvg <del> ] ++ optional synctexSupport texlive.bin.core ++ optional stdenv.isLinux libseccomp </del> <ins> texlive.bin.core ] ++ optional stdenv.isLinux libseccomp </ins> ++ optional stdenv.isDarwin gtk-mac-integration; doCheck = true;
{ config, pkgs # zathura_pdf_mupdf fails to load _opj_create_decompress at runtime on Darwin (https://github.com/NixOS/nixpkgs/pull/61295#issue-277982980) <del> , useMupdf ? config.zathura.useMupdf or (!pkgs.stdenv.isDarwin) , synctexSupport ? true }: </del> <ins> , useMupdf ? config.zathura.useMupdf or (!pkgs.stdenv.isDarwin) }: </ins> let callPackage = pkgs.newScope self;
merge = mergeEqualOption; }; <ins> nonEmptyStr = mkOptionType { name = "nonEmptyStr"; description = "non-empty string"; check = x: str.check x && builtins.match "[ tn]*" x == null; inherit (str) merge; }; </ins> strMatching = pattern: mkOptionType { name = "strMatching ${escapeNixString pattern}"; description = "string matching the pattern ${pattern}";
# https://wiki.archlinux.org/index.php/fstab#Filepath_spaces escape = string: builtins.replaceStrings [ " " "t" ] [ "040" "011" ] string; swapOptions = sw: concatStringsSep "," ( <del> [ "defaults" ] </del> <ins> sw.options </ins> ++ optional (sw.priority != null) "pri=${toString sw.priority}" ++ optional (sw.discardPolicy != null) "discard${optionalString (sw.discardPolicy != "both") "=${toString sw.discardPolicy}"}" );
}; "build/macosx/avrdude-6.3.0-arduino9-i386-apple-darwin11.tar.bz2" = fetchurl { url = "https://downloads.arduino.cc/tools/avrdude-6.3.0-arduino9-i386-apple-darwin11.tar.bz2"; <del> sha256 = "0rc4x8mcsva4v6j7ssfj8rdyg14l2pd9ivgdm39m5wnz8b06p85z11703f0r82aq3mmkiy7vwa4jfjhs9826qpp724hbng9dx74kk86r"; </del> <ins> sha256 = "0rc4x8mcsva4v6j7ssfj8rdyg14l2pd9ivgdm39m5wnz8b06p85z"; </ins> }; "build/macosx/appbundler/appbundler-1.0ea-arduino4.jar.zip" = fetchurl { url = "https://downloads.arduino.cc/appbundler-1.0ea-arduino4.jar.zip";
githubId = 11016164; name = "Fedor Pakhomov"; }; <ins> pamplemousse = { email = "xav.maso@gmail.com"; github = "Pamplemousse"; githubId = 2647236; name = "Xavier Maso"; }; </ins> panaeon = { email = "vitalii.voloshyn@gmail.com"; github = "panaeon";
<ins> { fetchFromGitHub , fetchurl , lz4 ? null , lz4Support ? false , lzma , lzo , stdenv , xz , zlib }: assert lz4Support -> (lz4 != null); let patch = fetchFromGitHub { owner = "devttys0"; repo = "sasquatch"; rev = "3e0cc40fc6dbe32bd3a5e6c553b3320d5d91ceed"; sha256 = "19lhndjv7v9w6nmszry63zh5rqii9v7wvsbpc2n6q606hyz955g2"; } + "/patches/patch0.txt"; in stdenv.mkDerivation rec { pname = "sasquatch"; version = "4.3"; src = fetchurl { url = mirror://sourceforge/squashfs/squashfs4.3.tar.gz; sha256 = "1xpklm0y43nd9i6jw43y2xh5zvlmj9ar2rvknh0bh7kv8c95aq0d"; }; buildInputs = [ lzma lzo xz zlib ] ++ stdenv.lib.optional lz4Support lz4; patches = [ patch ]; patchFlags = [ "-p0" ]; postPatch = '' cd squashfs-tools ''; installFlags = "INSTALL_DIR=${out}/bin"; makeFlags = [ "XZ_SUPPORT=1" ] ++ stdenv.lib.optional lz4Support "LZ4_SUPPORT=1"; meta = with stdenv.lib; { homepage = "https://github.com/devttys0/sasquatch"; description = "Set of patches to the standard unsquashfs utility (part of squashfs-tools) that attempts to add support for as many hacked-up vendor-specific SquashFS implementations as possible"; license = licenses.gpl2Plus; maintainers = [ maintainers.pamplemousse ]; platforms = platforms.linux; }; } </ins>
<ins> { stdenv, fetchFromGitHub, meson, sassc, pkg-config, glib, ninja, python3, gtk3, gnome3, gtk-engine-murrine }: stdenv.mkDerivation rec { pname = "yaru"; version = "19.10.2"; src = fetchFromGitHub { owner = "ubuntu"; repo = "yaru"; rev = version; sha256 = "1azyn8pr0kpbq4wlz91f5amqyxqq0x2mxkglzl488sf39fl0gnbj"; }; nativeBuildInputs = [ meson sassc pkg-config glib ninja python3 ]; buildInputs = [ gtk3 gnome3.gnome-themes-extra ]; propagatedUserEnvPkgs = [ gtk-engine-murrine ]; postPatch = "patchShebangs ."; meta = with stdenv.lib; { description = "Ubuntu community theme 'yaru' - default Ubuntu theme since 18.10"; homepage = https://github.com/ubuntu/yaru; license = with licenses; [ cc-by-sa-40 gpl3 ]; platforms = platforms.linux; maintainers = [ maintainers.jD91mZM2 ]; }; } </ins>
--replace '"python-interpreter", "python"' '"python-interpreter", "${python2Env}/bin/python"' ''; <del> nativeBuildInputs = [ pkgconfig cmake makeWrapper python2Env ] </del> <ins> nativeBuildInputs = [ pkgconfig cmake makeWrapper python2Env wrapGAppsHook ] </ins> ++ (with perlPackages; [ perl XMLParser ]); buildInputs = [ libXft libpng zlib popt boehmgc
<ins> { lib , stdenv , fetchFromGitHub , fish , runtimeShell , writeShellScript }: stdenv.mkDerivation rec { pname = "oh-my-fish"; version = "7+unstable=2021-03-03"; src = fetchFromGitHub { owner = pname; repo = pname; rev = "0b1396ad7962073fa25615bf03c43b53eddc2d56"; hash = "sha256-lwMo4+PcYR9kYJPWK+ALiMfBdxFSgB2vjtSn8QrmmEA="; }; buildInputs = [ fish ]; dontConfigure = true; dontBuild = true; installPhase = '' runHook preInstall mkdir -pv $out/bin $out/share/${pname} cp -vr * $out/share/${pname} cat << EOF > $out/bin/omf-install #!${runtimeShell} ${fish}/bin/fish  $out/share/${pname}/bin/install  --noninteractive  --offline=$out/share/${pname} EOF chmod +x $out/bin/omf-install runHook PostInstall ''; meta = with lib; { homepage = "https://github.com/oh-my-fish/oh-my-fish"; description = "The Fish Shell Framework"; longDescription = '' Oh My Fish provides core infrastructure to allow you to install packages which extend or modify the look of your shell. It's fast, extensible and easy to use. ''; license = licenses.mit; maintainers = with maintainers; [ AndersonTorres ]; platforms = fish.meta.platforms; }; } # TODO: customize the omf-install script </ins>
<ins> commit 970fb11a296b5bbdc5e8425851253d2c5913c45e Author: Leon Bottou <leon@bottou.org> Date:   Tue Mar 26 20:36:31 2019 -0400 Fix bug#296 diff --git a/libdjvu/DjVmDir.cpp b/libdjvu/DjVmDir.cpp index a6a39e0..0a0fac6 100644 --- a/libdjvu/DjVmDir.cpp +++ b/libdjvu/DjVmDir.cpp @@ -299,42 +299,44 @@ DjVmDir::decode(const GP<ByteStream> &gstr) memcpy((char*) strings+strings_size, buffer, length); } DEBUG_MSG("size of decompressed names block=" << strings.size() << "n"); -      if (strings[strings.size()-1] != 0) -        { -         int strings_size=strings.size(); -         strings.resize(strings_size+1); -         strings[strings_size] = 0; -        } +      int strings_size=strings.size(); +      strings.resize(strings_size+3); +      memset((char*) strings+strings_size, 0, 4); -         // Copy names into the files +      // Copy names into the files const char * ptr=strings; for(pos=files_list;pos;++pos) { GP<File> file=files_list[pos]; - +         if (ptr >= (const char*)strings + strings_size) +           G_THROW( "DjVu document is corrupted (DjVmDir)" ); file->id=ptr; ptr+=file->id.length()+1; if (file->flags & File::HAS_NAME) { -            file->name=ptr; -            ptr+=file->name.length()+1; -         } else +           file->name=ptr; +           ptr+=file->name.length()+1; +         } +         else { file->name=file->id; } if (file->flags & File::HAS_TITLE) { -            file->title=ptr; -       ptr+=file->title.length()+1; -         } else -       file->title=file->id; -   /* msr debug:  multipage file, file->title is null. +           file->title=ptr; +           ptr+=file->title.length()+1; +         } +         else +         { +           file->title=file->id; +         } +         /* msr debug:  multipage file, file->title is null. DEBUG_MSG(file->name << ", " << file->id << ", " << file->title << ", " << file->offset << ", " << file->size << ", " << file->is_page() << "n"); */ } -         // Check that there is only one file with SHARED_ANNO flag on +      // Check that there is only one file with SHARED_ANNO flag on int shared_anno_cnt=0; for(pos=files_list;pos;++pos) { </ins>
<ins> commit b1f4e1b2187d9e5010cd01ceccf20b4a11ce723f Author: Leon Bottou <leon@bottou.org> Date:   Tue Mar 26 20:45:46 2019 -0400 fix for bug #297 diff --git a/libdjvu/DjVmDir.cpp b/libdjvu/DjVmDir.cpp index 0a0fac6..5a49015 100644 --- a/libdjvu/DjVmDir.cpp +++ b/libdjvu/DjVmDir.cpp @@ -309,7 +309,7 @@ DjVmDir::decode(const GP<ByteStream> &gstr) { GP<File> file=files_list[pos]; if (ptr >= (const char*)strings + strings_size) -           G_THROW( "DjVu document is corrupted (DjVmDir)" ); +           G_THROW( ByteStream::EndOfFile ); file->id=ptr; ptr+=file->id.length()+1; if (file->flags & File::HAS_NAME) diff --git a/libdjvu/GBitmap.cpp b/libdjvu/GBitmap.cpp index 0e487f0..c2fdbe4 100644 --- a/libdjvu/GBitmap.cpp +++ b/libdjvu/GBitmap.cpp @@ -890,11 +890,13 @@ GBitmap::read_rle_raw(ByteStream &bs) int c = 0; while (n >= 0) { -      bs.read(&h, 1); +      if (bs.read(&h, 1) <= 0) +        G_THROW( ByteStream::EndOfFile ); int x = h; if (x >= (int)RUNOVERFLOWVALUE) { -          bs.read(&h, 1); +          if (bs.read(&h, 1) <= 0) +            G_THROW( ByteStream::EndOfFile ); x = h + ((x - (int)RUNOVERFLOWVALUE) << 8); } if (c+x > ncolumns) </ins>
<ins> commit e15d51510048927f172f1bf1f27ede65907d940d Author: Leon Bottou <leon@bottou.org> Date:   Mon Apr 8 22:25:55 2019 -0400 bug 299 fixed diff --git a/libdjvu/GContainer.h b/libdjvu/GContainer.h index 96b067c..0140211 100644 --- a/libdjvu/GContainer.h +++ b/libdjvu/GContainer.h @@ -550,52 +550,61 @@ public: template <class TYPE> void GArrayTemplate<TYPE>::sort(int lo, int hi) { -  if (hi <= lo) -    return; -  if (hi > hibound || lo<lobound) -    G_THROW( ERR_MSG("GContainer.illegal_subscript") ); TYPE *data = (TYPE*)(*this); -  // Test for insertion sort -  if (hi <= lo + 50) +  while(true) { -      for (int i=lo+1; i<=hi; i++) +      if (hi <= lo) +        return; +      if (hi > hibound || lo<lobound) +        G_THROW( ERR_MSG("GContainer.illegal_subscript") ); +      // Test for insertion sort +      if (hi <= lo + 50) { -          int j = i; -          TYPE tmp = data[i]; -          while ((--j>=lo) && !(data[j]<=tmp)) -            data[j+1] = data[j]; -          data[j+1] = tmp; +          for (int i=lo+1; i<=hi; i++) +            { +              int j = i; +              TYPE tmp = data[i]; +              while ((--j>=lo) && !(data[j]<=tmp)) +                data[j+1] = data[j]; +              data[j+1] = tmp; +            } +          return; } -      return; -    } -  // -- determine suitable quick-sort pivot -  TYPE tmp = data[lo]; -  TYPE pivot = data[(lo+hi)/2]; -  if (pivot <= tmp) -    { tmp = pivot; pivot=data[lo]; } -  if (data[hi] <= tmp) -    { pivot = tmp; } -  else if (data[hi] <= pivot) -    { pivot = data[hi]; } -  // -- partition set -  int h = hi; -  int l = lo; -  while (l < h) -    { -      while (! (pivot <= data[l])) l++; -      while (! (data[h] <= pivot)) h--; -      if (l < h) +      // -- determine median-of-three pivot +      TYPE tmp = data[lo]; +      TYPE pivot = data[(lo+hi)/2]; +      if (pivot <= tmp) +        { tmp = pivot; pivot=data[lo]; } +      if (data[hi] <= tmp) +        { pivot = tmp; } +      else if (data[hi] <= pivot) +        { pivot = data[hi]; } +      // -- partition set +      int h = hi; +      int l = lo; +      while (l < h) { -          tmp = data[l]; -          data[l] = data[h]; -          data[h] = tmp; -          l = l+1; -          h = h-1; +          while (! (pivot <= data[l])) l++; +          while (! (data[h] <= pivot)) h--; +          if (l < h) +            { +              tmp = data[l]; +              data[l] = data[h]; +              data[h] = tmp; +              l = l+1; +              h = h-1; +            } +        } +      // -- recurse, small partition first +      //    tail-recursion elimination +      if (h - lo <= hi - l) { +        sort(lo,h); +        lo = l; // sort(l,hi) +      } else { +        sort(l,hi); +        hi = h; // sort(lo,h) } } -  // -- recursively restart -  sort(lo, h); -  sort(l, hi); } template<class TYPE> inline TYPE& </ins>