Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD Fix getLoadedLibraries() crash (backport #2672) #2675

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jul 2, 2023

This is an automatic backport of pull request #2672 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

FreeBSD's getLoadedLibraries() uses libprocstat(3) to obtain
the list of mapped files (libraries). However, the list
obtained from procstat_getfiles() does not only return regular files,
but might also return anonymous objects that have no fs->path.

With exiv2 v0.28, I had also observed crashes with a real TTY,
and the entry->fs_path dereference would crash, even if it
was only for a test "non-null", so we need something more thorough.

Add a check to only consider VNODEs (actual file system entries),
and also make sure that entry->fs_path is defined so we don't
pass a nullptr to the std::string(const char *) constructor when
we are reading corrupt data. std::string((const char *)0)
on FreeBSD 13.2 - calls strlen() and crashes there.

(cherry picked from commit 91af090)
@ghost
Copy link

ghost commented Jul 2, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@codecov
Copy link

codecov bot commented Jul 2, 2023

Codecov Report

Merging #2675 (e8ca244) into 0.28.x (414bff1) will not change coverage.
The diff coverage is 31.14%.

@@           Coverage Diff           @@
##           0.28.x    #2675   +/-   ##
=======================================
  Coverage   63.92%   63.92%           
=======================================
  Files         103      103           
  Lines       22306    22306           
  Branches    10796    10795    -1     
=======================================
  Hits        14259    14259           
+ Misses       5827     5826    -1     
- Partials     2220     2221    +1     
Impacted Files Coverage Δ
include/exiv2/image.hpp 100.00% <ø> (ø)
include/exiv2/matroskavideo.hpp 60.00% <ø> (ø)
include/exiv2/value.hpp 85.11% <ø> (ø)
src/basicio.cpp 50.52% <0.00%> (ø)
src/canonmn_int.cpp 72.88% <ø> (ø)
src/nikonmn_int.cpp 61.20% <0.00%> (ø)
src/panasonicmn_int.cpp 52.58% <ø> (ø)
src/quicktimevideo.cpp 60.14% <0.00%> (ø)
src/rafimage.cpp 20.29% <ø> (ø)
src/riffvideo.cpp 62.18% <ø> (ø)
... and 10 more

@neheb neheb merged commit e892ca4 into 0.28.x Jul 2, 2023
@neheb neheb deleted the mergify/bp/0.28.x/pr-2672 branch July 2, 2023 18:56
@kevinbackhouse kevinbackhouse added this to the v0.28.1 milestone Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants