[bugfix]Cpp::TemplateDeclaration::setSpecializedFrom

Milian Wolff mail at milianw.de
Sun Feb 10 11:15:37 UTC 2013


On Saturday 09 February 2013 17:36:34 Artur Bać wrote:
> in Cpp::TemplateDeclaration::setSpecializedFrom (repo 1.5) has bug which
> allow cycling call of the same object, and this casuses SIGSEGV,
> propably stack overflow. See bellow stacktrace.
> 
> Bellow patch fixes crashing, but i think such situation should not
> happen at all, an object pointing at it self
> 
> diff --git languages/cpp/cppduchain/templatedeclaration.cpp
> languages/cpp/cppduchain/templatedeclaration.cpp
> index 9d8ba4c..4787361 100644
> --- languages/cpp/cppduchain/templatedeclaration.cpp
> +++ languages/cpp/cppduchain/templatedeclaration.cpp
> @@ -381,7 +381,10 @@ void
> TemplateDeclaration::setSpecializedFrom(TemplateDeclaration* other) {
>      return;
>    }
>    if(other && other->specializedFrom().data()) {
> -
> setSpecializedFrom(dynamic_cast<TemplateDeclaration*>(other->specializedFrom
> ().data())); +    Declaration* data_ptr = other->specializedFrom().data();
> +    TemplateDeclaration* tdecl =
> dynamic_cast<TemplateDeclaration*>(data_ptr);
> +    if( tdecl != this )
> +      setSpecializedFrom(tdecl);
>      return;
>    }

Can you reliably reproduce this bug? If so, with what project?

Cheers
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20130210/c34d36fa/attachment.sig>


More information about the KDevelop-devel mailing list