okular/core/synctex/patches/08-fix_cpp_comments.diff
Henrik Fehlauer dccd83783d Prevent Okular from crashing when synctex logs an error
bd20e48c3c updated Okular's copy of the synctex code to 1.19.
Unfortunately since this version the upstream code logs errors like
`"! SyncTeX Error : Ignored record...` when accessing selected synctex
files created with older versions of synctex.

The upstream `_synctex_log` contains `va_list arg` as a parameter, but
fails to initialize and tear down this properly via `va_start` and
`va_end`. In general this seems to work for the single argument case.
However, once we apply our hardening patch to get rid of the
`gnu_printf format attribute` warning and thus introduce a variadic
argument, things go wrong.

To fix this, we add the missing code. The remaining changes are just
refreshing the patches.

BUG: 383915

Test Plan:
Opening `empty.pdf` with `empty.synctex.gz` from
https://bugs.kde.org/attachment.cgi?id=109116 located
in the same folder does not lead to Okular segfaulting anymore.
2017-11-30 14:57:05 +01:00

38 lines
1.8 KiB
Diff

Fix cpp comments
Author: Albert Astals Cid <aacid@kde.org>
Index: synctex/synctex_parser.c
===================================================================
--- synctex.orig/synctex_parser.c
+++ synctex/synctex_parser.c
@@ -6048,7 +6048,7 @@ static int _synctex_scanner_get_tag(sync
}
} while((input = __synctex_tree_sibling(input)));
}
- // 2011 version
+ /* 2011 version */
name = _synctex_base_name(name);
if ((input = scanner->input)) {
do {
@@ -6058,7 +6058,7 @@ static int _synctex_scanner_get_tag(sync
if (_synctex_is_equivalent_file_name(name,_synctex_base_name(_synctex_data_name(other_input)))
&& (strlen(_synctex_data_name(input))!=strlen(_synctex_data_name(other_input))
|| strncmp(_synctex_data_name(other_input),_synctex_data_name(input),strlen(_synctex_data_name(input))))) {
- // There is a second possible candidate
+ /* There is a second possible candidate */
return 0;
}
}
Index: synctex/synctex_parser_utils.c
===================================================================
--- synctex.orig/synctex_parser_utils.c
+++ synctex/synctex_parser_utils.c
@@ -587,6 +587,6 @@ int _synctex_get_name(const char * outpu
const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode) {
static const char * synctex_io_modes[4] = {"r","rb","a","ab"};
- unsigned index = ((io_mode & synctex_io_gz_mask)?1:0) + ((io_mode & synctex_io_append_mask)?2:0);// bug pointed out by Jose Alliste
+ unsigned index = ((io_mode & synctex_io_gz_mask)?1:0) + ((io_mode & synctex_io_append_mask)?2:0);/* bug pointed out by Jose Alliste */
return synctex_io_modes[index];
}