AcademySoftwareFoundation / AcademySoftwareFoundation/OpenImageIO

building on Mac with Address Sanitizer. OpenImageIO_v_2_3::pvt::append_error gets null message and crashes

Open
#3,460 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.4k
Forks
698
Avg merge
3d 9h
Merged PRs (30d)
48

Description

when OIIO compiled on macOS Xcode 13 with sanitizer options. the pvt::append_error() function doesn't get the message variable passed as expected. becomes null

this doesn't happen when not building sanitized build

-fsanitize=address -fsanitize-recover=address -fsanitize=undefined,bounds,float-divide-by-zero,unsigned-integer-overflow,implicit-conversion -fsanitize-address-use-after-scope -fno-omit-frame-pointer -fno-sanitize=alignment,vptr,function

in this the .mov file is not recognized - not configured. the error message should be output

frame #4: 0x000000014d84911f libOpenImageIOMaya.2.3.10.dylib`OpenImageIOMaya_v2_3::ImageInput::create(filename=(m_chars = "/Users/mayadev/branch/maya/worktrees/main/Maya/data/Proprietary/images/testImagePlane.mov", m_len = 89), do_open=, config=, ioproxy=, plugin_searchpath=(m_chars = "p\xdc\xe8M\U00000001", m_len = 107614740670592)) at imageioplugin.cpp:783:13 [opt]
780 // best guess of the format.
781 OIIO::pvt::errorfmt("{}", specific_error);
782 } else if (Filesystem::exists(filename))
-> 783 pvt::errorfmt(
784 "OpenImageIO could not find a format reader for \"{}\". "
785 "Is it a file format that OpenImageIO doesn't know about?\n",
786 filename);

but instead we then crash on null object access. message has become null

frame #2: 0x000000014d7f925e libOpenImageIOMaya.2.3.10.dylib`OpenImageIOMaya_v2_3::pvt::append_error(message=(m_chars = 0x0000000000000000, m_len = 0)) at imageio.cpp:235:18 [opt]
232 // a single newline.
233 if (error_msg.size() && error_msg.back() != '\n')
234 error_msg += '\n';
-> 235 if (message.size() > 0)
236 error_msg += message;
237
238 // Remove a single trailing newline

Contributor guide

Open the contributing guide

Research direction

Start with imageioplugin.cpp at ImageInput::create and imageio.cpp at append_error, then trace the errorfmt call shown in the report. Reproduce the unrecognized .mov case on macOS with the listed Xcode sanitizer options and verify that the format-reader error is emitted without a crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.