Comments (7)
The AddressSanitizer error does not occur if optimization is disabled by changing -O1 to -O0 in the CMakeLists asan build type as follows:
set(CMAKE_CXX_FLAGS_ASAN
"-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O0"
CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds."
FORCE)
from ctl.
I've noticed some calls to alloca()
in CTL, which is a function that allocates memory on the stack instead of heap. I also noticed this note about silent failure in the "bugs" section of alloca()
man page https://man7.org/linux/man-pages/man3/alloca.3.html
alloca()
is used by CTL in these files:
.\ctlrender\tiff_file.cc
.\ctlrender\transform.cc
.\lib\dpx\dpx_util.cc
.\lib\IlmCtl\CtlExc.cpp
.\lib\IlmCtl\CtlTypeStorage.cpp
As described above, AddressSantizer gives SEGV error (which is the same error mentioned in the bugs section of alloca() man page) when running on the CTL's unit test IlmCtlTest,
=================================================================
==2075==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7fd0caafde64 bp 0x7ffd9bd418c0 sp 0x7ffd9bd41630 T0)
==2075==The signal is caused by a READ memory access.
==2075==Hint: address points to the zero page.
#0 0x7fd0caafde63 in Ctl::SimdInst::lineNumber() const /usr/src/CTL/lib/IlmCtlSimd/CtlSimdInst.h:93
#1 0x7fd0caafde63 in Ctl::SimdInst::executePath(Ctl::SimdBoolMask&, Ctl::SimdXContext&) const /usr/src/CTL/lib/IlmCtlSimd/CtlSimdInst.cpp:175
...
from ctl.
The reported AddressSanitizer error does not occur if lines 61-62 of file /lib/IlmCtlSimd/CtlSimdInst.cpp are changed
from:
#include <CtlSimdInst.h>
#include <sstream>
to:
#pragma GCC push_options
#pragma GCC optimize ("O0")
#include <CtlSimdInst.h>
#pragma GCC pop_options
#include <sstream>
to disable the compiler's optimization of CtlSimdInst.h
from ctl.
The reported AddressSanitizer error does not occur if lines 87-88 of file /lib/IlmCtlSimd/CtlSimdInst.h are compiled without optimization by changing
void executePath (SimdBoolMask &mask,
SimdXContext &xcontext) const;
to
#pragma GCC push_options
#pragma GCC optimize ("O0")
void executePath (SimdBoolMask &mask,
SimdXContext &xcontext) const;
#pragma GCC pop_options
from ctl.
The reported AddressSanitizer error occurs when unittest IlmCtlTest
processes line 96 of /unittest/IlmCtl/testVSArrays.ctl that calls the CTL code function empty()
int emptyA[1][2][3];
empty(emptyA);
CTL function empty()
on lines 56-60 /unittest/IlmCtl/testVSArrays.ctl is an empty ctl function
void
empty(int a[][][])
{
}
So perhaps the compiler optimization when using -O1 or higher is causing the useless function empty()
to be eliminated, thus the function pointer is zero, and disabling the compiler optimization with -O0 keeps the empty function and thus the function pointer is not zero.
from ctl.
To avoid attempting to call a function that has been optimized out, like CTL function empty()
on lines 56-60 /unittest/IlmCtl/testVSArrays.ctl , a check can be added to SimdCallInst::execute() before calling executePath() at line 449 of file /lib/IlmCtlSimd/CtlSimdInst.cpp
for example the line:
_callPath->executePath (callMask, xcontext);
can be changed to:
if( 0 != _callPath )
{
_callPath->executePath (callMask, xcontext);
}
from ctl.
A similar type of check can be added to SimdCallBranchInst::execute() on line 240 of /lib/IlmCtlSimd/CtlSimdInst.cpp
where _truePath->execute(mask, xcontext)
appears, change it to
if( 0 != _truePath )
_truePath->executePath (mask, xcontext);
where _falsePath->execute(mask, xcontext) appears, change it to
if( 0 != _falsePath )
_falsePath->executePath (mask, xcontext);
from ctl.
Related Issues (20)
- Not having a main() function causes a crash on Windows HOT 1
- ctlrender tests not working on Windows HOT 3
- CTL cmake does not find required dependencies when using apt-get install libilmbase-dev libopenexr-dev HOT 1
- EXR output resolutions are incorrect
- ctl_render dpx_read() should give error message when trying to open invalid filename
- install locations of a few files could be improved HOT 2
- Refactor exr_write() into a single function
- typo in include guard in dpx_raw.hh
- missing unit tests for code in directory /CTL/OpenEXR_CTL/exr_ctl_exr/ HOT 2
- missing unit tests for code in directory /CTL/OpenEXR_CTL/exrdpx/
- typo in \CTL\doc\CtlManual.pdf section 2.4 Arrays, Static Data and Lookup Tables
- typo in dpxToExr.cpp and exrToDpx.cpp
- Tiff read error when reading EXR file HOT 28
- LeakSanitizer: detected memory leaks when using -float argument with exr_ctl_exr HOT 2
- deprecation warning: 'uint32' is deprecated HOT 1
- 5 compile warnings on MacOs
- "Bad magic number" error on known valid OpenEXR files HOT 7
- New CTL programs HOT 6
- Build fails with strict-aliasing violations HOT 5
- Segmentation fault can result in ctlrender when the number of instructions gets too large
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctl.