Commit Graph

19 Commits

Author SHA1 Message Date
Ingo Klöcker
702ddec20f Include stdarg.h for va_start and va_end
Fixes "implicit declaration of function" error with devtoolset-10
(gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)) in centos7 Docker image
used for building an AppImage.

See also the original source code:
https://github.com/jlaurens/synctex/blob/2020/synctex_parser.c#L104
2023-07-12 08:45:43 +00:00
Willyanto Willyanto
5bb79f2cfd Add patch for call va_end() before return 2023-02-15 22:42:33 +00:00
Willyanto Willyanto
64e835103c Call va_end() before return
Fixes va_list 'arg' was opened but not closed by va_end(). (CWE-664)
2023-01-17 22:49:23 +07:00
Alex Richardson
0f4f3b1902 Fix -Werror build failure in synctex parser
I am cross-compiling with clang for FreeBSD and the build is failing with:
error: initializing 'char *' with an expression of type 'const char [1]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

Mark the char pointers as const to fix this build failure.
2021-07-12 14:18:39 +01:00
Alexander Lohnau
3c5cfc8abc Convert license files for core/synctex directory 2021-06-10 08:11:56 +00:00
Alexander Lohnau
3c1fa441d9 Remove dead code
A lot of this code has been commented out for over
a decade and adds no value to the project.
It is only annoying when you look over it ;).

Same for the KNS2 support which was commented out.

Also some of the debug statements didn't even build
anymore, because the properties got removed/refactored.
2020-11-14 10:52:00 +01:00
Thomas Friedrichsmeier
3fda3ba561 Fix build using MinGW 2020-09-11 16:24:44 +02:00
Albert Astals Cid
19d98d6a74 Run clang-format
find . \( -name "*.cpp" -or -name "*.h"  -or -name "*.c"  -or -name "*.cc" \) -exec clang-format -i {} \;

If you reached this file doing a git blame, please see README.clang-format (added 2 commits in the future of this one)
2020-07-11 09:17:33 +02:00
Yuri Chornoivan
5478b2ec92 Fix minor typos 2018-11-14 21:12:15 +02:00
Yuri Chornoivan
69c7b834d1 Fix minor API docs EBN issues 2018-10-19 09:00:06 +03:00
Yuri Chornoivan
c7722c4078 Fix minor EBN issues 2018-08-17 21:05:01 +03:00
Michel Ludwig
6b259d7000 Use Windows ANSI versions of the PathFind... methods
Differential Revision: https://phabricator.kde.org/D9937
2018-01-19 21:23:02 +01:00
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
Henrik Fehlauer
b6573a2713 Change whitespace in synctex patches
15-prevent-leaks-and-segfault.diff did not apply cleanly with quilt.
After fixing this, some of the other patches needed a refresh.
2017-11-30 12:45:58 +01:00
Henrik Fehlauer
bd20e48c3c Update to synctex 1.19
Summary:
This should prevent crashes when reloading some synctex-enabled pdf
files created with newer versions of TeXLive. We also gain bugfixes,
features and improved accuracy from the last 6 years of synctex
development.

Procedure followed:
- svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir
- Check out revision 45150
- Update files present in core/synctex/*
- Adapt Okular code to changes
- Review and drop or update/apply old patches using quilt
- Create missing patches for local synctex changes
- New patch: Omit warning message when opening non-synctex pdf
- Two new patches to fix more compiler warnings
- New patch: Plug multiple leaks and prevent a segfault

TODO for later:
- Move sync file detection code to Okular to never call into synctex C code for non-synctex files
- Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library

BUG: 383915
FIXED-IN: 17.12.0

Test Plan:
- No crash in synctex on reloading empty.pdf from bugreport anymore.
- Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line.
- Forward and backward search in Kile seems to work.
- Works with synctex files from both TeXLive 2015 and 2017.
- PartTest::testForwardPDF still passes.
- No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular.

Reviewers: #okular, sander, #kile, aacid

Reviewed By: #okular, aacid

Subscribers: mludwig, aacid

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7594
2017-09-12 21:56:49 +02:00
Martin T. H. Sandsmark
f87a306ec1 Fix warning about incompatible pointers in synctex parser 2016-07-24 22:30:39 +02:00
Martin T. H. Sandsmark
d5bdca64d2 Fix low hanging unused parameters warnings 2016-07-11 22:57:11 +02:00
Martin T. H. Sandsmark
25a1915daf Fix source file encoding 2016-07-11 22:45:39 +02:00
Albert Astals Cid
d95efa7698 Move synctex up to the core from poppler generator
This way dvi and any other potential user gets it for free

The diff is huge, but the synctex files are just moves.

And the code in core/ is also mostly just a move from the generator_pdf.cpp code

Acked by Luigi

REVIEW: 120311
2014-10-09 00:17:53 +02:00