Repository navigation
fix: solve issue #729 - [IssueHunt] Exports conflicting turbojpeg functions - #745
Open
mrbeastb118-del wants to merge 1 commit into
Open
mrbeastb118-del wants to merge 1 commit into
mrbeastb118-del wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Closes #729
Bounty Target: #729
Source: #729
Problem Description & Root Cause
If you'd like to put out an incentive for fixing this bug, you can do so at https://issuehunt.io/r/LibVNC/libvncserver
Describe the bug
libvncserver.so exports turbojpeg functions. If an application links to both libvncserver and libjpeg-turbo (either directly or indirectly through another library), it can cause the application to unexpectedly call the libvncserver implementation instead of the libjpeg-turbo implementation.
To Reproduce
test.c
Compile and run the attached test program:
gcc test.c -o test -lvncserver -lturbojpeg -ldl
./test
The exported symbols can also be seen using readelf:
readelf -Ws /usr/lib/libvncserver.so | awk '$7 != "UND" && $8 ~ /^tj/'
213: 0000000000035370 135 FUNC GLOBAL DEFAULT 10 tjDecompress
225: 00000000000348b0 206 FUNC GLOBAL DEFAULT 10 tjCompress
243: 0000000000034350 1363 FUNC GLOBAL DEFAULT 10 tjCompress2
262: 0000000000034100 183 FUNC GLOBAL DEFAULT 10 tjDestroy
294: 0000000000034210 63 FUNC GLOBAL DEFAULT 10 tjInitCompress
328: 0000000000034d00 58 FUNC GLOBAL DEFAULT 10 tjDecompressHeader
354: 0000000000034980 63 FUNC GLOBAL DEFAULT 10 tjInitDecompress
423: 0000000000034da0 1483 FUNC GLOBAL DEFAULT 10 tjDecompress2
439: 00000000000349c0 821 FUNC GLOBAL DEFAULT 10 tjDecompressHeader2
447: 0000000000034250 158 FUNC GLOBAL DEFAULT 10 tjBufSize
516: 0000000000034d40 82 FUNC GLOBAL DEFAULT 10 tjGetScalingFactors
528: 00000000000340f0 12 FUNC GLOBAL DEFAULT 10 tjGetErrorStr
Expected Output
Application tjCompress2 = 0x7f2a6f7ec1b0
libvncserver.so tjCompress2 = (nil)
libturbojpeg.so tjCompress2 = 0x7f2a6f7ec1b0
Actual Output
Application tjCompress2 = 0x7f2e6568a350
libvncserver.so tjCompress2 = 0x7f2e6568a350
libturbojpeg.so tjCompress2 = 0x7f2e6560a1b0
Application resolves to libvncserver's symbol
Your environment (please complete the following information):
Additional context
It resulted in a crash in reframe v1.10.5 as described in AlynxZhou/reframe#13
Changes Made
Verification & Test Evidence
Static verification passed: no automated test suite declared in repository manifest.AI & Tool Disclosure
Automated contribution adhering to repository CONTRIBUTING guidelines.