New Defects reported by Coverity Scan for LibreOffice

Armin Le Grand armin_le_grand at me.com
Wed Mar 30 07:55:01 UTC 2016


Done

Am 29.03.2016 um 09:30 schrieb Stephan Bergmann:
> Armin, can you take a look at the below two issues?  Code came in with 
> your 
> <https://cgit.freedesktop.org/cgit/?url=libreoffice/core/commit/&id=23391fdb5cffb62006415ad1f4c96b6ed5d50cf8> 
> "tdf#98646 Fixed freeze by flattening loops".
>
> On 03/24/2016 08:08 PM, scan-admin at coverity.com wrote:
>> ** CID 1357165:    (DIVIDE_BY_ZERO)
>> /sd/source/ui/view/drviewsh.cxx: 178 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> /sd/source/ui/view/drviewsh.cxx: 186 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> /sd/source/ui/view/drviewsh.cxx: 178 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> /sd/source/ui/view/drviewsh.cxx: 186 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>>
>>
>> ________________________________________________________________________________________________________ 
>>
>> *** CID 1357165:    (DIVIDE_BY_ZERO)
>> /sd/source/ui/view/drviewsh.cxx: 178 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 172                 else
>> 173                 {
>> 174                     const long distBottom(rRect.Bottom() - 
>> aNewPos.Y() + aVisAreaSize.Height());
>> 175
>> 176                     if(distBottom > 0)
>> 177                     {
>>>>>      CID 1357165: (DIVIDE_BY_ZERO)
>>>>>      In expression "distBottom / nFreeSpaceY", division by 
>>>>> expression "nFreeSpaceY" which may be zero has undefined behavior.
>> 178                         long mult = (distBottom / nFreeSpaceY) + 1;
>> 179                         aNewPos.Y() += mult * nFreeSpaceY;
>> 180                     }
>> 181
>> 182                     const long distTop(aNewPos.Y() - rRect.Top());
>> 183
>> /sd/source/ui/view/drviewsh.cxx: 186 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 180                     }
>> 181
>> 182                     const long distTop(aNewPos.Y() - rRect.Top());
>> 183
>> 184                     if(distTop > 0)
>> 185                     {
>>>>>      CID 1357165: (DIVIDE_BY_ZERO)
>>>>>      In expression "distTop / nFreeSpaceY", division by expression 
>>>>> "nFreeSpaceY" which may be zero has undefined behavior.
>> 186                         long mult = (distTop / nFreeSpaceY) + 1;
>> 187                         aNewPos.Y() -= mult * nFreeSpaceY;
>> 188                     }
>> 189                 }
>> 190             }
>> 191
>> /sd/source/ui/view/drviewsh.cxx: 178 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 172                 else
>> 173                 {
>> 174                     const long distBottom(rRect.Bottom() - 
>> aNewPos.Y() + aVisAreaSize.Height());
>> 175
>> 176                     if(distBottom > 0)
>> 177                     {
>>>>>      CID 1357165: (DIVIDE_BY_ZERO)
>>>>>      In expression "distBottom / nFreeSpaceY", division by 
>>>>> expression "nFreeSpaceY" which may be zero has undefined behavior.
>> 178                         long mult = (distBottom / nFreeSpaceY) + 1;
>> 179                         aNewPos.Y() += mult * nFreeSpaceY;
>> 180                     }
>> 181
>> 182                     const long distTop(aNewPos.Y() - rRect.Top());
>> 183
>> /sd/source/ui/view/drviewsh.cxx: 186 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 180                     }
>> 181
>> 182                     const long distTop(aNewPos.Y() - rRect.Top());
>> 183
>> 184                     if(distTop > 0)
>> 185                     {
>>>>>      CID 1357165: (DIVIDE_BY_ZERO)
>>>>>      In expression "distTop / nFreeSpaceY", division by expression 
>>>>> "nFreeSpaceY" which may be zero has undefined behavior.
>> 186                         long mult = (distTop / nFreeSpaceY) + 1;
>> 187                         aNewPos.Y() -= mult * nFreeSpaceY;
>> 188                     }
>> 189                 }
>> 190             }
>> 191
>>
>> ** CID 1357164:    (DIVIDE_BY_ZERO)
>> /sd/source/ui/view/drviewsh.cxx: 141 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> /sd/source/ui/view/drviewsh.cxx: 133 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> /sd/source/ui/view/drviewsh.cxx: 141 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> /sd/source/ui/view/drviewsh.cxx: 133 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>>
>>
>> ________________________________________________________________________________________________________ 
>>
>> *** CID 1357164:    (DIVIDE_BY_ZERO)
>> /sd/source/ui/view/drviewsh.cxx: 141 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 135                     }
>> 136
>> 137                     const long distLeft(aNewPos.X() - rRect.Left());
>> 138
>> 139                     if(distLeft > 0)
>> 140                     {
>>>>>      CID 1357164: (DIVIDE_BY_ZERO)
>>>>>      In expression "distLeft / nFreeSpaceX", division by 
>>>>> expression "nFreeSpaceX" which may be zero has undefined behavior.
>> 141                         long mult = (distLeft / nFreeSpaceX) + 1;
>> 142                         aNewPos.X() -= mult * nFreeSpaceX;
>> 143                     }
>> 144                 }
>> 145             }
>> 146
>> /sd/source/ui/view/drviewsh.cxx: 133 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 127                 else
>> 128                 {
>> 129                     const long distRight(rRect.Right() - 
>> aNewPos.X() + aVisAreaSize.Width());
>> 130
>> 131                     if(distRight > 0)
>> 132                     {
>>>>>      CID 1357164: (DIVIDE_BY_ZERO)
>>>>>      In expression "distRight / nFreeSpaceX", division by 
>>>>> expression "nFreeSpaceX" which may be zero has undefined behavior.
>> 133                         long mult = (distRight / nFreeSpaceX) + 1;
>> 134                         aNewPos.X() += mult * nFreeSpaceX;
>> 135                     }
>> 136
>> 137                     const long distLeft(aNewPos.X() - rRect.Left());
>> 138
>> /sd/source/ui/view/drviewsh.cxx: 141 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 135                     }
>> 136
>> 137                     const long distLeft(aNewPos.X() - rRect.Left());
>> 138
>> 139                     if(distLeft > 0)
>> 140                     {
>>>>>      CID 1357164: (DIVIDE_BY_ZERO)
>>>>>      In expression "distLeft / nFreeSpaceX", division by 
>>>>> expression "nFreeSpaceX" which may be zero has undefined behavior.
>> 141                         long mult = (distLeft / nFreeSpaceX) + 1;
>> 142                         aNewPos.X() -= mult * nFreeSpaceX;
>> 143                     }
>> 144                 }
>> 145             }
>> 146
>> /sd/source/ui/view/drviewsh.cxx: 133 in 
>> sd::DrawViewShell::MakeVisible(const Rectangle &, vcl::Window &)()
>> 127                 else
>> 128                 {
>> 129                     const long distRight(rRect.Right() - 
>> aNewPos.X() + aVisAreaSize.Width());
>> 130
>> 131                     if(distRight > 0)
>> 132                     {
>>>>>      CID 1357164: (DIVIDE_BY_ZERO)
>>>>>      In expression "distRight / nFreeSpaceX", division by 
>>>>> expression "nFreeSpaceX" which may be zero has undefined behavior.
>> 133                         long mult = (distRight / nFreeSpaceX) + 1;
>> 134                         aNewPos.X() += mult * nFreeSpaceX;
>> 135                     }
>> 136
>> 137                     const long distLeft(aNewPos.X() - rRect.Left());
>> 138
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libreoffice

-- 
--
ALG (PGP Key: EE1C 4B3F E751 D8BC C485 DEC1 3C59 F953 D81C F4A2)



More information about the LibreOffice mailing list