diff --git a/Third_Party_Open_Source_Software_Notice b/Third_Party_Open_Source_Software_Notice index 21914d41566..e6c97ec2009 100644 --- a/Third_Party_Open_Source_Software_Notice +++ b/Third_Party_Open_Source_Software_Notice @@ -4827,132 +4827,6 @@ must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. -Software: libtiff 4.2.0 -Copyright notice: -Copyright (C) 2003-2020 Free Software Foundation, Inc. -Copyright (c) 1996 BancTec AB -Copyright (c) 1990, 1993 The Regents of the University of California. All rights reserved. -Copyright (c) 1991-1996 Silicon Graphics, Inc. -Copyright (c) 2008, Andrey Kiselev -Copyright (C) 1999-2020 Free Software Foundation, Inc. -Copyright (c) 2003, Andrey Kiselev -Copyright (c) 1997 Greg Ward Larson -Copyright (c) 1996 Pixar -.\" Additional code Copyright (c) 2006-2009 Richard Nolde .\" Lasted Updated 9/2009 .\" .if n .po 0 -Copyright (c) 1996 Mike Johnson -Copyright (c) 1995-1997 Silicon Graphics, Inc. -Copyright (c) 1992-1997 Silicon Graphics, Inc. -Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software Foundation, Inc. -Copyright (c) 2018, Mapbox Author: -Copyright (C) 1996-2020 Free Software Foundation, Inc. -.\" Copyright (c) 2002, Andrey Kiselev -printf(" : Copyright (c) 1991-1997 Silicon Graphics, Inc\n"); -Copyright (C) 1996-2018 Free Software Foundation, Inc. -Copyright (c) 1994-1997 Sam Leffler -Copyright (c) 1988-1996 Sam Leffler -Copyright (c) 2003 Ross Finlayson -Copyright (C) 2002-2020 Free Software Foundation, Inc. -Copyright (c) 1990-1997 Sam Leffler -Copyright (c) 1991-1996 Sam Leffler -Copyright (c) 1999, Frank Warmerdam -Copyright © 2015 Open Microscopy Environment / University of Dundee Written by Roger Leigh -dnl Copyright (c) 2008 Steven G. Johnson -Copyright (c) 2009 Frank Warmerdam -Copyright (c) 1997 Silicon Graphics, Inc. -Copyright (C) 2005, Andrey Kiselev -printf("Tiffcrop additions: Copyright (c) 2007-2010 Richard Nolde\n"); -Copyright (C) 2006-2020 Free Software Foundation, Inc. -Copyright (c) 1988-1997 Sam Leffler -.\" Copyright (c) 1988-1997 Sam Leffler -Copyright (C) 2007, Andrey Kiselev -Copyright (C) 2011 Free Software Foundation, Inc. -Copyright (c) 1989, 1993 The Regents of the University of California. All rights reserved. -Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software Foundation, Inc. -Copyright (c) AWare Systems -Copyright (C) 2001-2020 Free Software Foundation, Inc. -Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler -Copyright (c) 1994-1997 Silicon Graphics, Inc. -Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. -Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software Foundation, Inc. -Copyright (C) 1994 X Consortium -Copyright (c) 2003 Citrus Project, All rights reserved. -Copyright (C) 1999-2018 Free Software Foundation, Inc. -Copyright (c) 2002, Andrey Kiselev -Additions (c) Richard Nolde 2006-2010 -.\" Copyright (c) 2012, Tom Lane -Copyright (C) 2004-2020 Free Software Foundation, Inc. -(c) Alexey Chupahin 22-NOV-2007 OpenVMS 7.3-1, DEC 2000 mod.300 -Copyright 1992-2014 Free Software Foundation, Inc. -Copyright (C) 2012 Free Software Foundation, Inc. -Copyright (c) 2005 The DragonFly Project. All rights reserved. -Copyright (c) 2004, Andrey Kiselev -.\" Copyright (c) 2003 Ross Finlayson -Copyright (C) 1997-2020 Free Software Foundation, Inc. -dnl Copyright (c) 2009 Braden McDaniel -Copyright (c) 2000, Frank Warmerdam -Copyright (c) 2010, Andrey Kiselev -.\" Copyright (c) 1992-1997 Silicon Graphics, Inc. -.\" Copyright (c) 1991-1997 Sam Leffler -Copyright (C) 2004, Andrey Kiselev -Copyright (c( 1996 USAF Phillips Laboratory -Copyright (c) 1991-1997 Silicon Graphics, Inc. -.\" Copyright (c) 1995 Silicon Graphics, Inc. -Copyright (c) 2017, Planet Labs Author: -printf("Tiffcp code: Copyright (c) 1988-1997 Sam Leffler\n"); -Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts. -Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts. -Copyright (C) 2009-2020 Free Software Foundation, Inc. -Copyright (c) 1995-1997 Sam Leffler -Copyright (c) 2007, Frank Warmerdam -Copyright (c) 1987, 1993 The Regents of the University of California. All rights reserved. -Copyright (c) 2019, Even Rouault -Copyright (C) 1990, 1995 Frank D. Cringle. -Copyright (C) 1994-2020 Free Software Foundation, Inc. -.\" Copyright (c) 1995 Sam Leffler -Copyright (c) 1991, 1992 Silicon Graphics, Inc. -Copyright (c) 2012, Frank Warmerdam -Copyright (c) 1991-1997 Sam Leffler -dnl Copyright (C) 2004, Andrey Kiselev -.\" Copyright (c) 2003, Andrey Kiselev -Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. -Copyright (c) 2019, Thomas Bernard -define TIFFLIBVERSIONSTR "LIBTIFF, Version 4.2.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." -Copyright (c) 1987, 1993, 1994 The Regents of the University of California. All rights reserved. -{ TIFFTAGCOPYRIGHT, "Copyright (c) 2004, Andrey Kiselev" }, { TIFFTAGFAXSUBADDRESS, "Fax subaddress" }, DGN tags { TIFFTAGUNIQUECAMERAMODEL, "No camera" }, { TIFFTAGCAMERASERIALNUMBER, "1234567890" } -Copyright (c) Joris Van Damme -Copyright (c) 1985, 1986 The Regents of the University of California. -.\" Copyright (c) 1992-1997 Sam Leffler -Copyright (c) 1990 by Sun Microsystems, Inc. -.\" Copyright (c) 1991-1997 Silicon Graphics, Inc. -Copyright (c) 1996-1997 Sam Leffler -.\" Copyright (c) 1990-1997 Sam Leffler -Copyright (c) 1992-1997 Sam Leffler -Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -Copyright (C) 2014 Free Software Foundation, Inc. -$! (c) Alexey Chupahin 22-NOV-2007 $! elvis75@mail.ru - -Copyright (c) 1988-1997 Sam Leffler -Copyright (c) 1991-1997 Silicon Graphics, Inc. - -Permission to use, copy, modify, distribute, and sell this software and -its documentation for any purpose is hereby granted without fee, provided -that (i) the above copyright notices and this permission notice appear in -all copies of the software and related documentation, and (ii) the names of -Sam Leffler and Silicon Graphics may not be used in any advertising or -publicity relating to the software without the specific, prior written -permission of Sam Leffler and Silicon Graphics. - -THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, -EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY -WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - -IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR -ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, -OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF -LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -OF THIS SOFTWARE. - Software: libevent 2.1.12 Copyright notice: Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. diff --git a/cmake/external_libs/libtiff.cmake b/cmake/external_libs/libtiff.cmake deleted file mode 100644 index 34c397a554c..00000000000 --- a/cmake/external_libs/libtiff.cmake +++ /dev/null @@ -1,36 +0,0 @@ -if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(tiff_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \ - -Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2") - set(tiff_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \ - -Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2") -else() - set(tiff_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-unused-result \ - -Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2") - set(tiff_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-unused-result \ - -Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2") - if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(tiff_CFLAGS "${tiff_CFLAGS} -Wno-int-to-pointer-cast -Wno-implicit-fallthrough -Wno-pointer-to-int-cast") - endif() -endif() - -set(tiff_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") - -if(ENABLE_GITEE) - set(REQ_URL "https://gitee.com/mirrors/libtiff/repository/archive/v4.2.0.tar.gz") - set(MD5 "1b8f32e39940ffbdac3638f7081ba9e0") -else() - set(REQ_URL "http://download.osgeo.org/libtiff/tiff-4.2.0.tar.gz") - set(MD5 "2bbf6db1ddc4a59c89d6986b368fc063") -endif() - -mindspore_add_pkg(tiff - VER 4.2.0 - LIBS tiff - URL ${REQ_URL} - MD5 ${MD5} - CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -Djbig=OFF -Dlzma=OFF -Djpeg12=OFF -Dzstd=OFF -Dpixarlog=OFF - -Dold-jpeg=OFF -Dwebp=OFF -DBUILD_SHARED_LIBS=OFF -Dlibdeflate=OFF - PATCHES ${TOP_DIR}/third_party/patch/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 - PATCHES ${TOP_DIR}/third_party/patch/libtiff/CVE-2022-0908.patch002) -message("tiff include = ${tiff_INC}") -message("tiff lib = ${tiff_LIB}") diff --git a/cmake/external_libs/opencv.cmake b/cmake/external_libs/opencv.cmake index b502e627d3c..73f32eada08 100644 --- a/cmake/external_libs/opencv.cmake +++ b/cmake/external_libs/opencv.cmake @@ -50,7 +50,7 @@ if(MSVC) -DBUILD_ZLIB=ON -DBUILD_JPEG=ON -DBUILD_PNG=ON - -DBUILD_OPENEXR=OFF + -DWITH_OPENEXR=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_apps=OFF @@ -59,12 +59,12 @@ if(MSVC) -DBUILD_opencv_videoio=OFF -DWITH_FFMPEG=OFF -DWITH_TIFF=ON - -DBUILD_TIFF=OFF + -DBUILD_TIFF=ON -DWITH_JASPER=OFF -DBUILD_JASPER=OFF -DCV_TRACE=OFF # cause memory usage increacing - -DTIFF_INCLUDE_DIR=${tiff_INC} - -DTIFF_LIBRARY=${tiff_LIB}) + PATCHES ${TOP_DIR}/third_party/patch/opencv/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 + PATCHES ${TOP_DIR}/third_party/patch/opencv/libtiff/CVE-2022-0908.patch002) elseif(WIN32) mindspore_add_pkg(opencv VER 4.5.2 @@ -77,7 +77,7 @@ elseif(WIN32) -DBUILD_ZLIB=ON -DBUILD_JPEG=ON -DBUILD_PNG=ON - -DBUILD_OPENEXR=OFF + -DWITH_OPENEXR=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_apps=OFF @@ -86,13 +86,13 @@ elseif(WIN32) -DBUILD_opencv_videoio=OFF -DWITH_FFMPEG=OFF -DWITH_TIFF=ON - -DBUILD_TIFF=OFF + -DBUILD_TIFF=ON -DWITH_JASPER=OFF -DBUILD_JASPER=OFF -DCV_TRACE=OFF # cause memory usage increacing -DWITH_LAPACK=OFF - -DTIFF_INCLUDE_DIR=${tiff_INC} - -DTIFF_LIBRARY=${tiff_LIB}) + PATCHES ${TOP_DIR}/third_party/patch/opencv/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 + PATCHES ${TOP_DIR}/third_party/patch/opencv/libtiff/CVE-2022-0908.patch002) else() mindspore_add_pkg(opencv VER 4.5.2 @@ -104,7 +104,7 @@ else() -DBUILD_ZLIB=ON -DBUILD_JPEG=ON -DBUILD_PNG=ON - -DBUILD_OPENEXR=OFF + -DWITH_OPENEXR=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_apps=OFF @@ -112,13 +112,13 @@ else() -DBUILD_opencv_python3=OFF -DWITH_FFMPEG=OFF -DWITH_TIFF=ON - -DBUILD_TIFF=OFF + -DBUILD_TIFF=ON -DWITH_JASPER=OFF -DBUILD_JASPER=OFF -DCV_TRACE=OFF # cause memory usage increacing -DWITH_LAPACK=OFF - -DTIFF_INCLUDE_DIR=${tiff_INC} - -DTIFF_LIBRARY=${tiff_LIB}) + PATCHES ${TOP_DIR}/third_party/patch/opencv/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 + PATCHES ${TOP_DIR}/third_party/patch/opencv/libtiff/CVE-2022-0908.patch002) endif() if(MSVC) diff --git a/cmake/mind_expression.cmake b/cmake/mind_expression.cmake index 0280144ca82..b21b7015a49 100644 --- a/cmake/mind_expression.cmake +++ b/cmake/mind_expression.cmake @@ -67,7 +67,6 @@ endif() if(ENABLE_MINDDATA) include(${CMAKE_SOURCE_DIR}/cmake/external_libs/icu4c.cmake) - include(${CMAKE_SOURCE_DIR}/cmake/external_libs/libtiff.cmake) include(${CMAKE_SOURCE_DIR}/cmake/external_libs/opencv.cmake) include(${CMAKE_SOURCE_DIR}/cmake/external_libs/sqlite.cmake) include(${CMAKE_SOURCE_DIR}/cmake/external_libs/tinyxml2.cmake) diff --git a/third_party/patch/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 b/third_party/patch/opencv/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 similarity index 77% rename from third_party/patch/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 rename to third_party/patch/opencv/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 index c771be0cea6..948b05779f9 100644 --- a/third_party/patch/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 +++ b/third_party/patch/opencv/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001 @@ -1,6 +1,6 @@ -diff -Npur libtiff-v4.2.0/libtiff/tif_dirread.c libtiff-v4.2.0-change/libtiff/tif_dirread.c ---- libtiff-v4.2.0/libtiff/tif_dirread.c 2020-12-20 02:44:58.000000000 +0800 -+++ libtiff-v4.2.0-change/libtiff/tif_dirread.c 2022-03-17 18:04:49.959583584 +0800 +diff -Npur opencv-4.5.2/3rdparty/libtiff/tif_dirread.c opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c +--- opencv-4.5.2/3rdparty/libtiff/tif_dirread.c 2021-04-02 19:23:54.000000000 +0800 ++++ opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c 2022-05-21 14:44:25.639756094 +0800 @@ -4173,7 +4173,8 @@ TIFFReadDirectory(TIFF* tif) goto bad; } @@ -17,7 +17,7 @@ diff -Npur libtiff-v4.2.0/libtiff/tif_dirread.c libtiff-v4.2.0-change/libtiff/ti } - _TIFFmemcpy(resizeddata,data,(uint32)dir->tdir_count*sizeof(uint64)); - _TIFFmemset(resizeddata+(uint32)dir->tdir_count,0,(nstrips-(uint32)dir->tdir_count)*sizeof(uint64)); -+ if( dir->tdir_count ) ++ if( dir->tdir_count ) + _TIFFmemcpy(resizeddata,data, (uint32)dir->tdir_count * sizeof(uint64)); + _TIFFmemset(resizeddata+(uint32)dir->tdir_count, 0, (nstrips - (uint32)dir->tdir_count) * sizeof(uint64)); _TIFFfree(data); diff --git a/third_party/patch/libtiff/CVE-2022-0908.patch002 b/third_party/patch/opencv/libtiff/CVE-2022-0908.patch002 similarity index 56% rename from third_party/patch/libtiff/CVE-2022-0908.patch002 rename to third_party/patch/opencv/libtiff/CVE-2022-0908.patch002 index 8b441bd49cd..53f29746d75 100644 --- a/third_party/patch/libtiff/CVE-2022-0908.patch002 +++ b/third_party/patch/opencv/libtiff/CVE-2022-0908.patch002 @@ -1,6 +1,6 @@ -diff -Npur libtiff-v4.2.0/libtiff/tif_dirread.c libtiff-v4.2.0-change/libtiff/tif_dirread.c ---- libtiff-v4.2.0/libtiff/tif_dirread.c 2020-12-20 02:44:58.000000000 +0800 -+++ libtiff-v4.2.0-change/libtiff/tif_dirread.c 2022-03-21 19:27:48.016570736 +0800 +diff -Npur opencv-4.5.2/3rdparty/libtiff/tif_dirread.c opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c +--- opencv-4.5.2/3rdparty/libtiff/tif_dirread.c 2021-04-02 19:23:54.000000000 +0800 ++++ opencv-4.5.2-new/3rdparty/libtiff/tif_dirread.c 2022-05-21 14:36:31.761285562 +0800 @@ -5079,7 +5079,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEnt _TIFFfree(data); return(0);