-
Notifications
You must be signed in to change notification settings - Fork 43
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
clang AddressSanitizer: global-buffer-overflow in map_dos.c map_plot() #73
Comments
Is it possible to add the CFLAGS to our OSX builds on Travis-CI? Maybe that wouldn't make sense long-term on a CI engine, but more of a once-a-year trial by one of the developers to catch anything introduced by new code? |
Unfortunately you need to actually run the program to see anything resulting from adding the flags, so doing it in Travis doesn't really get us anything. It would be nice if there was some way to take advantage of this in an automated way. I'm working on another bug it found where we were doing a 200 byte fill on a 100 byte array. I've been thinking about having some automated tests for xastir would be a nice addition for travis-ci. Given that xastir is a X11 program there are chunks that would probably be hard to test, but we could maybe starting working on more standalone pieces. |
Trying another fix. This one looks better:
|
FYI: "npoints-1" is used several times in maps.c, and "npoints - 1" is used in maps.c and map_dos.c. Similar fixes may need to be done for maps.c. |
I haven't looked at the mapping code before (besides filing this bug) so I need to look at it for a bit before I feel qualified to comment. (Which is why I haven't done anything with this bug yet.) If Tom is OK with your changes before I have time to understand what is happening here I'll defer to him. |
I do not understand this code, either, and am not prepared to sign off on it. It's not at all clear what it's trying to do. |
Fun isn't it? I think that was one of the original bits of map code, before
I joined the project in 1999. Very few comments. I _think_ there are limits
on how long a vector is supposed to be and they're using "npoints" to
determine that. Add to that the map viewport which might be a subset of the
map we're drawing or might be larger than the map we're drawing, so we
check whether we're trying to draw inside or outside of the viewport (and
don't draw if it's outside). I see a comparison: "if (npoints >
MAX_MAP_POINTS)" in one spot. Looks like "npoints" is used in map_dos.c,
map_shp.c, map_tif.c, and maps.c. I must have fully understood it at some
point 'cuz my first entry into the Xastir project was writing map_tif.c
from scratch.
…On Tue, May 7, 2019 at 2:47 PM Tom Russo ***@***.***> wrote:
I do not understand this code, either, and am not prepared to sign off on
it. It's not at all clear what it's trying to do.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#73 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEMNKX66K56ODJ5VNT3U7QLPUH2GLANCNFSM4HHTMCZQ>
.
--
Curt, WE7U http://we7u.wetnet.net http://www.sarguydigital.com
|
Yes, git log shows that the code in question has been present in maps.c since it was imported into sourceforge CVS in commit fa09e55. |
I wonder if we should defer this until after the next release since it is a long standing bug and the fix is not obvious. |
+1
…On Wed, May 8, 2019 at 7:25 AM Jason Godfrey ***@***.***> wrote:
I wonder if we should defer this until after the next release since it is
a long standing bug and the fix is not obvious.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#73 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEMNKX36GHAHHEAGPWORFKLPULPFJANCNFSM4HHTMCZQ>
.
--
Curt, WE7U http://we7u.wetnet.net http://www.sarguydigital.com
|
I don't wonder, I think it's a sleeping dog we should let lie for a few more weeks. Let's just move it off the ToDo for this release in the Kanban. |
While running clangs -fsanitize=address feature an error is encountered with worldhi.map enabled:
The relevant chunk of code is:
In this case npoints is 0 so the points [npoints - 1] expression reads outside the array. I'll need to study the code for a bit in order to figure out what an appropriate fix would be. I may move on and see if there are other errors I can encounter first.
To run with this clang feature enabled I ran configure with CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
The text was updated successfully, but these errors were encountered: