OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

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

Open wayne-arnold-adsk opened this issue 3 years ago • 5 comments
trafficstars

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

wayne-arnold-adsk avatar Jun 29 '22 17:06 wayne-arnold-adsk

Hi, Wayne. I'm a little confused about how to reproduce this. The idea here is... you're trying to open a .mov file, but the ffmpeg reader is not enabled at all? Is that the circumstance in which the error happens?

Do you have a reliable way to reproduce it with any of the bundled programs like oiiotool?

lgritz avatar Jul 03 '22 06:07 lgritz

Correct, ffmpeg not configured in this case. I have a number of workflows. if there is no extension on the filename provide to ::open() then will attempt to output an error message. this is just on the sanitizer build on Mac. not sure what triggered this. may be compiler update I'll try with oiiotool

wayne-arnold-adsk avatar Jul 04 '22 13:07 wayne-arnold-adsk

Also, can you try a build with the current master? The code in that region has changed between 2.3 and 2.4, and we're very close to a 2.4 release, which will then be the main supported branch moving forward. So if it's something that's already fixed and 2.3 is about to be obsolete, we may not want to bother chasing this down.

lgritz avatar Jul 04 '22 15:07 lgritz

will give it a try

wayne-arnold-adsk avatar Jul 05 '22 18:07 wayne-arnold-adsk

on our build using 2.3.10 - can reproduce when using oiitool from our build we don't include .mov support, or just use a file extension that isn't supported. ie aa.ffff running: oiiotool -I aaa.mov results in ASAN abort. this is on a Mac, Monterey 12.4. Xcode 13.4.1

still need to setup for the master build. is there a timeline for when 2.4.x is expected ?

oiiotool-san.txt

our normal sanitizer options are: -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

for the time being I've disabled building OpenImageIO with sanitizer flags. overriding our normal build settings by adding: "-flat_namespace -fno-sanitize=all -fomit-frame-pointer -Wl,-undefined,suppress"

wayne-arnold-adsk avatar Jul 15 '22 19:07 wayne-arnold-adsk