[mapserver-dev] Mapserver assertion handling causing potential crashes

Tamas Szekeres szekerest at gmail.com
Sat Feb 12 12:26:28 PST 2022


Even,

Thank you for the fix. I agree that assert does have it's own purpose (when
debugging), but the code should never expect that assert will do anything
to prevent the code to continue the execution (like what throwing an
exception would do). So dereferencing a null pointer in the subsequent code
without checking the pointer against null is prohibited.

Best regards,

Tamas


Even Rouault <even.rouault at spatialys.com> ezt írta (időpont: 2022. febr.
12., Szo, 20:25):

> Hopefully https://github.com/MapServer/MapServer/pull/6477 should fix that
>
> to use or not to use assert(), and where, is one of the many debates for
> which devs will have different opinions :
> https://stackoverflow.com/questions/1081409/why-should-i-use-asserts .
> I'd say assert() are supposed to be used for conditions you don't
> anticipate to happen in practice and thus for which you don't have a plan
> if they occur (a good reason is because you can't test it and thus the
> error handling might be broken because untested). Of course practice
> sometimes/often later contradicts your theories, as the impossible has a
> trend to occur more often than you'd like :-)
>
> Even
> Le 12/02/2022 à 19:49, Steve Lime a écrit :
>
> *ert( layer->layerinfo != N*
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> MapServer-dev mailing list
> MapServer-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20220212/a9df70a4/attachment.html>


More information about the MapServer-dev mailing list