Hello. This message for OpenCPN
I have discover source code and (how it's seems to me) found some mistakes
that may lead to crash the executing program.
1. In many places there is next code:
strncpy( buf, value.mb_str(), vallen );
In same time wxWidgets documentation
converts the string to the encoding used by the current
locale and so CAN RETURN AN EMPTY STRING (NULL) if the string contains characters not representable in it.
I'm using russian S57 charts
and program raise access violation error at address 00000000 in strncpy.
2. Source file gshhs.cpp. Constructor:
doesn't initialize class members W, H, XC, CY, xW and others. Calling Projection::updateBoundaries() (from Projection::SetScale) raise floating point overflow error at
...atan( exp( (double) ( degToRad( PY - H / ( 2 * scale ) ) )...
because H does not defined.
3. Source file mygeom.cpp. Method PolyTessGeo::PolyTessGeoTri.
Variable ntpa is calculated and geoPt allocated:
pt *geoPt = (pt*)malloc((npta + 1) * sizeof(pt));
Then not all pt will be assigned because of
if((fabs(x-x0) > EQUAL_EPS) || (fabs(y-y0) > EQUAL_EPS))
ppt->x = x;
ppt->y = y;
and later the for-loop:
for(ip = 1 ; ip < npta + 1 ; ip++)
if(TESS_HORZ == tess_orient)
ty = geoPt[ip].y;
tx = geoPt[ip].x;
will raise floating point error.
Thanks for attention. Serge Gavrilov (aka AltMonk).