openjpeg/src/lib/openjp2
Mark Mentovai 093ccb0ecd openjp2/j2k: replace sprintf calls with snprintf
This makes it possible to build j2k.c without warnings using the macOS
13 SDK. Calls to sprintf are replaced with snprintf, passing appropriate
buffer sizes.

It doesn’t appear that any of the changed uses of sprintf were actually
unsafe, so no behavior change is expected aside from SDK compatibility.

The macOS 13 SDK deprecates sprintf as it’s difficult to use safely. The
deprecation warning message is visible when building C++, but it is not
normally visible when building plain C code due to a quirk in how
sprintf is declared in the SDK. However, the deprecation message is
visible when building plain C under Address Sanitizer
(-fsanitize=address). This discrepancy was discovered at
https://crbug.com/1381706 and reported to Apple with a copy at
https://openradar.appspot.com/FB11761475.

The macOS 13 SDK is packaged in Xcode 14.1, released on 2022-11-01. This
also affects the iOS 16 SDK and other 2022-era Apple OS SDKs packaged in
Xcode 14.0, released on 2022-09-12.

j2k.c is visible to the Chromium build via PDFium, and this change is
needed to allow Chromium to move forward to the macOS 13 SDK.

This change is limited to src/lib/openjp2. Other uses of sprintf were
found throughout openjpeg.
2022-11-07 09:54:52 -05:00
..
CMakeLists.txt CMake: switch to GNUInstallDirs (#1424) 2022-08-07 16:42:01 +02:00
bench_dwt.c Fix some typos (found by codespell) 2021-12-05 13:14:33 +01:00
bio.c Micro-optimization: use directly opj_bio_putbit() instead of opj_bio_write() to emit single bit 2022-08-11 16:41:57 +02:00
bio.h Micro-optimization: use directly opj_bio_putbit() instead of opj_bio_write() to emit single bit 2022-08-11 16:41:57 +02:00
cidx_manager.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
cidx_manager.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
cio.c Avoid p_stream->m_user_data_length >= (OPJ_UINT64)p_stream->m_byte_offset assertion in opj_stream_get_number_byte_left(). Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2786. Credit to OSS Fuzz 2017-07-30 16:48:15 +02:00
cio.h Fix some typos (found by codespell) 2021-12-05 13:14:33 +01:00
dwt.c Avoid integer overflows in DWT. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44544 2022-02-10 14:30:13 +01:00
dwt.h Irreversible compression/decompression DWT: use 1/K constant as per standard 2020-05-20 20:31:28 +02:00
event.c opj_event_msg(): force zero termination of buffer 2017-07-30 19:27:01 +02:00
event.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
function_list.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
function_list.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
ht_dec.c Replace the assert in mel_init to an if statement to address an issue with fuzzing. (#1436) 2022-08-11 18:29:40 +02:00
image.c API: deprecate 'bpp' member in favor of 'prec' 2021-10-21 14:13:58 +02:00
image.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
indexbox_manager.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
invert.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
invert.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
j2k.c openjp2/j2k: replace sprintf calls with snprintf 2022-11-07 09:54:52 -05:00
j2k.h Cleanup code related to quality layer allocation, and add a few safety checks 2022-08-11 18:12:07 +02:00
jp2.c Fix Heap-buffer-overflow READ in opj_jp2_apply_pclr (#1441) 2022-08-12 15:48:41 +02:00
jp2.h Add support for partial bitstream decoding (#1407) (fixes #715) 2022-02-10 14:27:17 +01:00
libopenjp2.pc.cmake.in CMake: switch to GNUInstallDirs (#1424) 2022-08-07 16:42:01 +02:00
mct.c Fix potential overflow related issues spotted by LGTM code analysis (#1402) 2022-01-18 21:55:10 +01:00
mct.h Encoder: use floating-point operations for irreversible transformation 2020-05-20 20:31:28 +02:00
mqc.c T1 encoder: speed-up by aggressive inlining and more cache friendly data organization 2020-05-24 15:38:48 +02:00
mqc.h T1 encoder: speed-up by aggressive inlining and more cache friendly data organization 2020-05-24 15:38:48 +02:00
mqc_inl.h T1 encoder: speed-up by aggressive inlining and more cache friendly data organization 2020-05-24 15:38:48 +02:00
openjpeg.c Add support for partial bitstream decoding (#1407) (fixes #715) 2022-02-10 14:27:17 +01:00
openjpeg.h Cleanup code related to quality layer allocation, and add a few safety checks 2022-08-11 18:12:07 +02:00
opj_clock.c Fix mingw related warnings 2017-06-21 12:54:40 +02:00
opj_clock.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
opj_codec.h Add support for partial bitstream decoding (#1407) (fixes #715) 2022-02-10 14:27:17 +01:00
opj_common.h Implement writing of IMF profiles 2020-02-12 15:55:25 +01:00
opj_config.h.cmake.in [trunk] Finalize API for openjpeg 2.1 2014-04-28 09:17:31 +00:00
opj_config_private.h.cmake.in Fix support of posix_memalign for Linux 2016-01-06 18:06:45 +01:00
opj_includes.h Sub-tile decoding: only allocate tile component buffer of the needed dimension 2017-09-01 16:30:29 +02:00
opj_intmath.h Fix incorrect decoding of image with large number of progression levels 2022-10-18 23:03:05 +02:00
opj_inttypes.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
opj_malloc.c IDWT 5x3: generalize SSE2 version for AVX2 2017-06-21 12:12:58 +02:00
opj_malloc.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
opj_stdint.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
phix_manager.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
pi.c Fix incorrect decoding of image with large number of progression levels 2022-10-18 23:03:05 +02:00
pi.h pi.c: avoid out of bounds access with POC (refs https://github.com/uclouvain/openjpeg/issues/1293#issuecomment-737122836) 2020-12-02 14:03:11 +01:00
ppix_manager.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
sparse_array.c Fix potential overflow related issues spotted by LGTM code analysis (#1402) 2022-01-18 21:55:10 +01:00
sparse_array.h Add missing newline at end of file 2017-09-21 17:37:07 +02:00
t1.c Cleanup code related to quality layer allocation, and add a few safety checks 2022-08-11 18:12:07 +02:00
t1.h Fix some typos (found by codespell) 2021-12-05 13:14:33 +01:00
t1_generate_luts.c Added support for high throughput (HTJ2K) decoding. 2021-09-25 12:26:59 +02:00
t1_ht_generate_luts.c Fix some typos (found by codespell) 2021-12-05 13:14:33 +01:00
t1_ht_luts.h Added support for high throughput (HTJ2K) decoding. 2021-09-25 12:26:59 +02:00
t1_luts.h T1: Transpose coder optimizations to decoder, and cleanup code 2017-06-02 18:20:35 +02:00
t2.c Micro-optimization: use directly opj_bio_putbit() instead of opj_bio_write() to emit single bit 2022-08-11 16:41:57 +02:00
t2.h Add support for generation of PLT markers in encoder 2020-04-21 15:55:44 +02:00
tcd.c Cleanup code related to quality layer allocation, and add a few safety checks 2022-08-11 18:12:07 +02:00
tcd.h Cleanup code related to quality layer allocation, and add a few safety checks 2022-08-11 18:12:07 +02:00
test_sparse_array.c Optimize reading/write into sparse array 2017-09-01 16:30:50 +02:00
tgt.c Micro-optimization: use directly opj_bio_putbit() instead of opj_bio_write() to emit single bit 2022-08-11 16:41:57 +02:00
tgt.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
thix_manager.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
thread.c opj_thread_pool_setup(): fix infinite waiting if a thread creation failed 2018-10-18 11:45:45 +02:00
thread.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
tls_keys.h src/lib/openjp2/*.h: use OPJ_ prefix for inclusion guards instead of reserved __ (#587) 2017-07-30 19:46:52 +02:00
tpix_manager.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00