[opensuse-packaging] Function returning random data : build failed, ideas for fixes ?
Hi, I'm building a mapserver5 version in With the latest version which contain security bug fixes I'm now getting a build failed I: Program returns random data in a function E: mapserver5 no-return-in-nonvoid-function mapogr.cpp:3500 Here the function /************************************************************************/ /* msOGREscapeSQLParam */ /************************************************************************/ char *msOGREscapeSQLParam(layerObj *layer, const char *pszString) { char* pszEscapedStr =NULL; #ifdef USE_OGR if(layer && pszString && strlen(pszString) > 0) { char* pszEscapedOGRStr = CPLEscapeString(pszString, strlen(pszString), CPLES_SQL ); pszEscapedStr = strdup(pszEscapedOGRStr); CPLFree(pszEscapedOGRStr); return pszEscapedStr; } #else /* ------------------------------------------------------------------ * OGR Support not included... * ------------------------------------------------------------------ */ msSetError(MS_MISCERR, "OGR support is not available.", "msOGREscapeSQLParam()"); return NULL; #endif /* USE_OGR */ } How can I ride off of the error ? return pszString (string untouched ?) sorry my c/c++ knowledge are very limited. -- Bruno Friedmann Ioda-Net Sàrl www.ioda-net.ch openSUSE Member & Ambassador GPG KEY : D5C9B751C4653227 irc: tigerfoot -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Wed, Jul 27, 2011 at 10:52:57AM +0200, Bruno Friedmann wrote:
Hi, I'm building a mapserver5 version in
With the latest version which contain security bug fixes I'm now getting a build failed
I: Program returns random data in a function E: mapserver5 no-return-in-nonvoid-function mapogr.cpp:3500
Here the function /************************************************************************/ /* msOGREscapeSQLParam */ /************************************************************************/ char *msOGREscapeSQLParam(layerObj *layer, const char *pszString) { char* pszEscapedStr =NULL; #ifdef USE_OGR if(layer && pszString && strlen(pszString) > 0) { char* pszEscapedOGRStr = CPLEscapeString(pszString, strlen(pszString), CPLES_SQL ); pszEscapedStr = strdup(pszEscapedOGRStr); CPLFree(pszEscapedOGRStr); return pszEscapedStr; }
<<<<<<<<< Here should be a return too. Perhaps a return NULL;? z
#else /* ------------------------------------------------------------------ * OGR Support not included... * ------------------------------------------------------------------ */
msSetError(MS_MISCERR, "OGR support is not available.", "msOGREscapeSQLParam()"); return NULL;
#endif /* USE_OGR */ }
How can I ride off of the error ? return pszString (string untouched ?)
sorry my c/c++ knowledge are very limited.
See insert above. Ciao, Marcus -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Wednesday, July 27, 2011 10:52:57 Bruno Friedmann wrote:
Hi, I'm building a mapserver5 version in
With the latest version which contain security bug fixes I'm now getting a build failed
I: Program returns random data in a function E: mapserver5 no-return-in-nonvoid-function mapogr.cpp:3500
Here the function /************************************************************************/ /* msOGREscapeSQLParam */ /************************************************************************/ char *msOGREscapeSQLParam(layerObj *layer, const char *pszString) { char* pszEscapedStr =NULL; #ifdef USE_OGR if(layer && pszString && strlen(pszString) > 0) { char* pszEscapedOGRStr = CPLEscapeString(pszString, strlen(pszString), CPLES_SQL ); pszEscapedStr = strdup(pszEscapedOGRStr); CPLFree(pszEscapedOGRStr); return pszEscapedStr; }
Insert here a: return NULL or move the return above to this place (has the same effect).
#else /* ------------------------------------------------------------------ * OGR Support not included... * ------------------------------------------------------------------ */
msSetError(MS_MISCERR, "OGR support is not available.", "msOGREscapeSQLParam()"); return NULL;
#endif /* USE_OGR */ }
How can I ride off of the error ? return pszString (string untouched ?)
Previously it returned random data, so I would not return usable data now...
sorry my c/c++ knowledge are very limited.
Andreas -- Andreas Jaeger, Program Manager openSUSE aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
See inside ... On 07/27/2011 11:06 AM, Marcus Meissner wrote:
On Wed, Jul 27, 2011 at 10:52:57AM +0200, Bruno Friedmann wrote:
Hi, I'm building a mapserver5 version in
With the latest version which contain security bug fixes I'm now getting a build failed
I: Program returns random data in a function E: mapserver5 no-return-in-nonvoid-function mapogr.cpp:3500
Here the function /************************************************************************/ /* msOGREscapeSQLParam */ /************************************************************************/ char *msOGREscapeSQLParam(layerObj *layer, const char *pszString) { char* pszEscapedStr =NULL; #ifdef USE_OGR if(layer && pszString && strlen(pszString) > 0) { char* pszEscapedOGRStr = CPLEscapeString(pszString, strlen(pszString), CPLES_SQL ); pszEscapedStr = strdup(pszEscapedOGRStr); CPLFree(pszEscapedOGRStr); return pszEscapedStr; }
<<<<<<<<< Here should be a return too. Perhaps a return NULL;? z
In fact by moving the return pszEscapedStr; outside the if it simply work if we don't go inside the if, so pszEscapedStr is NULL and this this what returned. Once that pushed by a patch, the osc build success now . It's exactly what they do inside the original code one function below see http://trac.osgeo.org/mapserver/browser/branches/branch-5-6/mapserver/mapogr... around line 3498
Once I will have tested my build, and use that functions, it seems I've to create a patch for upstream :-) (the easiest and safest, is renaming the comment :D)
#else /* ------------------------------------------------------------------ * OGR Support not included... * ------------------------------------------------------------------ */
msSetError(MS_MISCERR, "OGR support is not available.", "msOGREscapeSQLParam()"); return NULL;
#endif /* USE_OGR */ }
How can I ride off of the error ? return pszString (string untouched ?)
sorry my c/c++ knowledge are very limited.
See insert above.
Ciao, Marcus
Thanks for your precious advices ... -- Bruno Friedmann Ioda-Net Sàrl www.ioda-net.ch openSUSE Member & Ambassador GPG KEY : D5C9B751C4653227 irc: tigerfoot -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (3)
-
Andreas Jaeger
-
Bruno Friedmann
-
Marcus Meissner