Skip to content
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

The potential risk of shape.importfromwkt() #159

Closed
wangxiya opened this issue Apr 13, 2019 · 1 comment
Closed

The potential risk of shape.importfromwkt() #159

wangxiya opened this issue Apr 13, 2019 · 1 comment
Assignees

Comments

@wangxiya
Copy link

OLE2A(str) has limit of length of str, it is 4k, when I import a multipolygon from wkt, Sometime the length of wkt will break 4k。

code:
STDMETHODIMP CShape::ImportFromWKT(BSTR Serialized, VARIANT_BOOL *retVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
*retVal = VARIANT_FALSE;

USES_CONVERSION;
CString ser = OLE2A(Serialized);

OGRGeometry* oGeom = NULL;
char* buffer = ser.GetBuffer();

suggest:
char* pBuf = _com_util::ConvertBSTRToString(Serialized);

char *pszBuffBack = pBuf;

OGRGeometry* oGeom = NULL;
OGRErr err = OGRGeometryFactory::createFromWkt(&pBuf, NULL, &oGeom);
delete[] pszBuffBack;	
@pmeems
Copy link
Contributor

pmeems commented Apr 13, 2019

Thanks for taking the time to report this.

You can make a pull request against the develop branch.
We will investigate it and merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants