include/basebmp/clippedlinerenderer.hxx | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
New commits: commit 6182437f8312e5823b3c9022993730428e572667 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Aug 25 11:31:30 2014 +0100 return false if the clip region would div by zero Change-Id: Ia0928306b3608df9c48a19b517edac54ba43bd57 diff --git a/include/basebmp/clippedlinerenderer.hxx b/include/basebmp/clippedlinerenderer.hxx index 077ff48..b3a5fd09 100644 --- a/include/basebmp/clippedlinerenderer.hxx +++ b/include/basebmp/clippedlinerenderer.hxx @@ -89,7 +89,12 @@ inline bool prepareClip( sal_Int32 a1, if( clipCode1 & (aMinFlag|aMaxFlag) ) { - cb = (ca + da - int(!bRoundTowardsPt2)) / (2*da); + sal_Int32 da2 = 2*da; + + if (da2 == 0) + return false; // overflow + + cb = (ca + da - int(!bRoundTowardsPt2)) / (da2); if( sb >= 0 ) { @@ -104,11 +109,16 @@ inline bool prepareClip( sal_Int32 a1, return false; // fully clipped } - io_rem += ca - 2*da*cb; + io_rem += ca - da2*cb; } else { - ca = (cb - da + 2*db - int(bRoundTowardsPt2)) / (2*db); + sal_Int32 db2 = 2*db; + + if (db2 == 0) + return false; // overflow + + ca = (cb - da + db2 - int(bRoundTowardsPt2)) / (db2); if( sa >= 0 ) { o_as = a1 + ca; @@ -122,7 +132,7 @@ inline bool prepareClip( sal_Int32 a1, return false; // fully clipped } - io_rem += 2*db*ca - cb; + io_rem += db2*ca - cb; } } else commit 739adde53bf93afa1d1cd2ea2ecaf0754feec934 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Aug 25 11:22:04 2014 +0100 detect conditions where loop cannot logically end Change-Id: I7e2ec1e09614510e6798ba8d5b9990c189a8dbb9 diff --git a/include/basebmp/clippedlinerenderer.hxx b/include/basebmp/clippedlinerenderer.hxx index acb9cda..077ff48 100644 --- a/include/basebmp/clippedlinerenderer.hxx +++ b/include/basebmp/clippedlinerenderer.hxx @@ -269,6 +269,9 @@ void renderClippedLine( basegfx::B2IPoint aPt1, if( bUseAlternateBresenham ) { + if (rem < 0 && ady <= 0) + return; //break will never be hit under these circumstances + while(true) { acc.set(color, rowIter); @@ -347,6 +350,9 @@ void renderClippedLine( basegfx::B2IPoint aPt1, if( bUseAlternateBresenham ) { + if (rem < 0 && adx <= 0) + return; //break will never be hit under these circumstances + while(true) { acc.set(color, colIter);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits