[umbrello] [Bug 373911] After upgrading to 2.20.90 from version 2.20.3, umbrello crash when I try to open model created with 2.20.3

Ralf Habacker bugzilla_noreply at kde.org
Tue Jan 3 11:25:50 UTC 2017


https://bugs.kde.org/show_bug.cgi?id=373911

--- Comment #15 from Ralf Habacker <ralf.habacker at freenet.de> ---
(In reply to Ralf Habacker from comment #14)
> Unfortunally I cannot see yet why calling dynamic_cast(0) could fail:
> http://stackoverflow.com/questions/5155820/portably-safe-to-pass-null-zero-
> to-dynamic-cast mentions that it should be possible.

It turned out that this a windows only gcc issue.

For the following method 

    UMLClassifier* UMLObject::asUMLClassifier() { return
dynamic_cast<UMLClassifier*>(this); }

the following assembler code is created on linux:

_ZN9UMLObject15asUMLClassifierEv:
        testq   %rdi, %rdi 
        je      .L152
        xorl    %ecx, %ecx
        movl    $_ZTI13UMLClassifier, %edx
        movl    $_ZTI9UMLObject, %esi
        jmp     __dynamic_cast
.L152:
        xorl    %eax, %eax
        ret

The first codes in method checks against null pointer parameter. 
>        testq   %rdi, %rdi 
>        je      .L152

on windows: 

__ZN9UMLObject15asUMLClassifierEv:
        subl    $28, %esp
        movl    $0, 12(%esp)
        movl    $__ZTI13UMLClassifier, 8(%esp)
        movl    $__ZTI9UMLObject, 4(%esp)
        movl    %ecx, (%esp)
        call    ___dynamic_cast
        addl    $28, %esp
        ret

-> there is no null pointer check

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list