Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CImg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ians-nmh-siebert
extern
CImg
Commits
6d404f1d
Commit
6d404f1d
authored
6 years ago
by
David Tschumperlé
Browse files
Options
Downloads
Patches
Plain Diff
CImg<T>::_cubic_at???(): Fix bad memory access when NaN coordinates are provided.
parent
2e5b53b9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CImg.h
+8
-8
8 additions, 8 deletions
CImg.h
with
8 additions
and
8 deletions
CImg.h
+
8
−
8
View file @
6d404f1d
...
@@ -13817,7 +13817,7 @@ namespace cimg_library_suffixed {
...
@@ -13817,7 +13817,7 @@ namespace cimg_library_suffixed {
Tfloat _cubic_atX(const float fx, const int y=0, const int z=0, const int c=0) const {
Tfloat _cubic_atX(const float fx, const int y=0, const int z=0, const int c=0) const {
const float
const float
nfx = cimg::cut(fx,0,width() - 1);
nfx =
cimg::type<float>::is_nan(fx)?0:
cimg::cut(fx,0,width() - 1);
const int
const int
x = (int)nfx;
x = (int)nfx;
const float
const float
...
@@ -13896,13 +13896,13 @@ namespace cimg_library_suffixed {
...
@@ -13896,13 +13896,13 @@ namespace cimg_library_suffixed {
Tfloat _cubic_atXY(const float fx, const float fy, const int z=0, const int c=0) const {
Tfloat _cubic_atXY(const float fx, const float fy, const int z=0, const int c=0) const {
const float
const float
nfx = cimg::cut(fx,0,width() - 1),
nfx =
cimg::type<float>::is_nan(fx)?0:
cimg::cut(fx,0,width() - 1),
nfy = cimg::cut(fy,0,height() - 1);
nfy =
cimg::type<float>::is_nan(fy)?0:
cimg::cut(fy,0,height() - 1);
const int x = (int)nfx, y = (int)nfy;
const int x = (int)nfx, y = (int)nfy;
const float dx = nfx - x, dy = nfy - y;
const float dx = nfx - x, dy = nfy - y;
const int
const int
px = x - 1<0?0:x - 1, nx = dx
>
0?x + 1
:x
, ax = x + 2>=width()?width() - 1:x + 2,
px = x - 1<0?0:x - 1, nx = dx
<=
0?x
:x
+ 1, ax = x + 2>=width()?width() - 1:x + 2,
py = y - 1<0?0:y - 1, ny = dy
>
0?y + 1
:y
, ay = y + 2>=height()?height() - 1:y + 2;
py = y - 1<0?0:y - 1, ny = dy
<=
0?y
:y
+ 1, ay = y + 2>=height()?height() - 1:y + 2;
const Tfloat
const Tfloat
Ipp = (Tfloat)(*this)(px,py,z,c), Icp = (Tfloat)(*this)(x,py,z,c), Inp = (Tfloat)(*this)(nx,py,z,c),
Ipp = (Tfloat)(*this)(px,py,z,c), Icp = (Tfloat)(*this)(x,py,z,c), Inp = (Tfloat)(*this)(nx,py,z,c),
Iap = (Tfloat)(*this)(ax,py,z,c),
Iap = (Tfloat)(*this)(ax,py,z,c),
...
@@ -14046,9 +14046,9 @@ namespace cimg_library_suffixed {
...
@@ -14046,9 +14046,9 @@ namespace cimg_library_suffixed {
Tfloat _cubic_atXYZ(const float fx, const float fy, const float fz, const int c=0) const {
Tfloat _cubic_atXYZ(const float fx, const float fy, const float fz, const int c=0) const {
const float
const float
nfx = cimg::cut(fx,0,width() - 1),
nfx =
cimg::type<float>::is_nan(fx)?0:
cimg::cut(fx,0,width() - 1),
nfy = cimg::cut(fy,0,height() - 1),
nfy =
cimg::type<float>::is_nan(fy)?0:
cimg::cut(fy,0,height() - 1),
nfz = cimg::cut(fz,0,depth() - 1);
nfz =
cimg::type<float>::is_nan(fz)?0:
cimg::cut(fz,0,depth() - 1);
const int x = (int)nfx, y = (int)nfy, z = (int)nfz;
const int x = (int)nfx, y = (int)nfy, z = (int)nfz;
const float dx = nfx - x, dy = nfy - y, dz = nfz - z;
const float dx = nfx - x, dy = nfy - y, dz = nfz - z;
const int
const int
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment