Compare commits

...

5 Commits

Author SHA1 Message Date
Kornel
d23e3fc586 Update release token 2020-09-29 11:41:33 +01:00
Kornel Lesiński
f1d512de2f Make test output match turbojpeg tests 2020-09-29 11:41:14 +01:00
dofuuz
751ce7d9f3 Automate Windows build and deploy (with PNG support) (#379) 2020-09-29 11:40:16 +01:00
Kornel
ffea183e55 Response to the rumor mill 2020-09-29 10:32:19 +01:00
dofuuz
3fed7e016b Add PNG support to cjpeg shared build 2020-09-20 23:11:41 +01:00
5 changed files with 89 additions and 15 deletions

View File

@@ -681,6 +681,14 @@ if(ENABLE_STATIC)
endif()
if(PNG_SUPPORTED)
# to avoid finding shared library from CMake cache
unset(PNG_LIBRARY CACHE)
unset(PNG_LIBRARY_RELEASE CACHE)
unset(PNG_LIBRARY_DEBUG CACHE)
unset(ZLIB_LIBRARY CACHE)
unset(ZLIB_LIBRARY_RELEASE CACHE)
unset(ZLIB_LIBRARY_DEBUG CACHE)
if (APPLE)
find_package(ZLIB REQUIRED) # macos doesn't have static zlib
endif()

View File

@@ -1,3 +1,11 @@
> ## News: About Instagram's flaw
>
> Instagram had [a security vulnerability](https://m.facebook.com/security/advisories/cve-2020-1895). Instagram uses MozJPEG. These two facts were somewhat conflated in the [vulnerability report](https://research.checkpoint.com/2020/instagram_rce-code-execution-vulnerability-in-instagram-app-for-android-and-ios/) that gets reposted all over the Internet right now.
> MozJPEG is **NOT** affected by this vulnerability. The issue was in Facebook's own integration code, unique to only Instagram, and not in MozJPEG. There will be no MozJPEG patches in response to that report, because it's not a MozJPEG issue.
----
Mozilla JPEG Encoder Project [![Build Status](https://ci.appveyor.com/api/projects/status/github/mozilla/mozjpeg?branch=master&svg=true)](https://ci.appveyor.com/project/kornel/mozjpeg-4ekrx)
============================

View File

@@ -1,26 +1,62 @@
image: Visual Studio 2017
configuration: Release
platform:
- Win32
- x64
install:
## Download nasm
- mkdir nasm
- cd nasm
- appveyor DownloadFile https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/win64/nasm-2.14.02-win64.zip -FileName nasm.zip
- 7z e -y nasm.zip
- set PATH=%PATH%;%CD%
## Prepare cmake
- cd %APPVEYOR_BUILD_FOLDER%
- mkdir cmake_build
- if %PLATFORM% == Win32 (set ARCH=x86)
- if %PLATFORM% == x64 (set ARCH=x64)
## Set up nasm
- choco install nasm
- set PATH=%PATH%;C:\Program Files\NASM
## Set up libpng
- cd C:\Tools\vcpkg
- vcpkg install libpng:%ARCH%-windows
- vcpkg install libpng:%ARCH%-windows-static
before_build:
- cd %APPVEYOR_BUILD_FOLDER%
- nasm -v
- cmake --version
- cd cmake_build
- cmake .. -G "Visual Studio 15 2017" -DPNG_SUPPORTED=NO
- git describe --always --tags --dirty
- FOR /F %%a in ('git describe --always --tags --dirty') do set GIT_VERSION=%%a
build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- msbuild cmake_build\mozjpeg.sln
## Build shared
- cmake -B shared -A %PLATFORM%
-DENABLE_SHARED=1 -DENABLE_STATIC=0
-DREQUIRE_SIMD=1
-DCMAKE_TOOLCHAIN_FILE=C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
- cmake --build shared --config Release
## Build static
- cmake -B static -A %PLATFORM%
-DENABLE_SHARED=0 -DENABLE_STATIC=1
-DREQUIRE_SIMD=1
-DCMAKE_TOOLCHAIN_FILE=C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=%ARCH%-windows-static
- cmake --build static --config Release
after_build:
- 7z a mozjpeg-%GIT_VERSION%-win-%ARCH%.zip shared/Release static/Release
artifacts:
- path: cmake_build\**\Release\**\*.exe
- path: cmake_build\**\Release\**\*.lib
- path: '*.zip'
cache:
- C:\ProgramData\chocolatey\bin
- C:\ProgramData\chocolatey\lib
- C:\Program Files\NASM
- C:\tools\vcpkg\installed
deploy:
description: 'Automated build using Appveyor'
provider: GitHub
auth_token:
secure: 2Jj47Q5HnaPob9U4yX2t4q4TYTw4JWU6cS56mM12aoRLgfYkZ4gRZPySIzfmTPqC
artifact: /.*\.zip/
on:
APPVEYOR_REPO_TAG: true # deploy on tag push only

View File

@@ -72,6 +72,12 @@ else()
set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}")
set(CJPEG_BMP_SOURCES ../rdbmp.c ../rdtarga.c)
set(DJPEG_BMP_SOURCES ../wrbmp.c ../wrtarga.c)
if(PNG_SUPPORTED)
report_option(PNG_SUPPORTED "PNG reading support")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -DPNG_SUPPORTED")
set(CJPEG_BMP_SOURCES ${CJPEG_BMP_SOURCES} ../rdpng.c)
endif()
endif()
add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdgif.c ../rdppm.c ../rdjpeg.c
@@ -79,6 +85,21 @@ add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdgif.c ../rdppm.c ../rdjpeg.c
set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS})
target_link_libraries(cjpeg jpeg)
if(PNG_SUPPORTED)
# to avoid finding static library from CMake cache
unset(PNG_LIBRARY CACHE)
unset(PNG_LIBRARY_RELEASE CACHE)
unset(PNG_LIBRARY_DEBUG CACHE)
unset(ZLIB_LIBRARY CACHE)
unset(ZLIB_LIBRARY_RELEASE CACHE)
unset(ZLIB_LIBRARY_DEBUG CACHE)
find_package(PNG 1.6 REQUIRED)
find_package(ZLIB REQUIRED)
target_include_directories(cjpeg PUBLIC ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
target_link_libraries(cjpeg ${PNG_LIBRARY} ${ZLIB_LIBRARY})
endif()
add_executable(djpeg ../djpeg.c ../cdjpeg.c ../rdcolmap.c ../rdswitch.c
../wrgif.c ../wrppm.c ${DJPEG_BMP_SOURCES})
set_property(TARGET djpeg PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS})

View File

@@ -476,6 +476,7 @@ static tjhandle _tjInitCompress(tjinstance *this)
}
jpeg_create_compress(&this->cinfo);
jpeg_c_set_int_param(&this->cinfo, JINT_COMPRESS_PROFILE, JCP_FASTEST);
/* Make an initial call so it will create the destination manager */
jpeg_mem_dest_tj(&this->cinfo, &buf, &size, 0);