[Libreoffice-commits] core.git: 9 commits - canvas/source sc/inc sc/source sw/inc sw/source vcl/opengl vcl/source
Caolán McNamara
caolanm at redhat.com
Sun Dec 7 06:17:34 PST 2014
canvas/source/cairo/cairo_canvashelper_text.cxx | 12 ++++++------
canvas/source/cairo/cairo_textlayout.cxx | 6 +-----
canvas/source/cairo/cairo_textlayout.hxx | 2 +-
sc/inc/fillinfo.hxx | 12 +-----------
sc/inc/table.hxx | 9 ---------
sc/source/core/data/fillinfo.cxx | 1 +
sw/inc/ring.hxx | 16 +++++++++-------
sw/source/core/doc/textboxhelper.cxx | 2 +-
vcl/opengl/program.cxx | 13 +++++++++----
vcl/source/fontsubset/sft.cxx | 8 ++++----
10 files changed, 33 insertions(+), 48 deletions(-)
New commits:
commit f9f243b1ed1314d7f5d04924e36502a8899ff13d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Dec 7 14:16:06 2014 +0000
fdo#42785 fix crashing again with this doc in 4-4 series
Change-Id: I834c97a373c55733515e8e1e4945b0f1cd972f89
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index c59bcbd..d0c99df 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -257,7 +257,7 @@ SwFrmFmt* SwTextBoxHelper::findTextBox(const SwFrmFmt* pShape)
SwFrmFmt* pRet = 0;
// Only draw frames can have TextBoxes.
- if (pShape->Which() == RES_DRAWFRMFMT && pShape->GetAttrSet().HasItem(RES_CNTNT))
+ if (pShape && pShape->Which() == RES_DRAWFRMFMT && pShape->GetAttrSet().HasItem(RES_CNTNT))
{
const SwFmtCntnt& rCntnt = pShape->GetCntnt();
const SwFrmFmts& rSpzFrmFmts = *pShape->GetDoc()->GetSpzFrmFmts();
commit 4ac876084bb89b6460b31e090a666b395f66b1e8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Dec 7 11:52:14 2014 +0000
mpSurface->getCairo() == mpCairo
so make that clearer, and we only need to pass a Cairo context
not a surface here
Change-Id: If385dbd4e8a546fa18c2f93650428fe0ed0c76fc
diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx
index c9c3702..5530eed 100644
--- a/canvas/source/cairo/cairo_canvashelper_text.cxx
+++ b/canvas/source/cairo/cairo_canvashelper_text.cxx
@@ -299,8 +299,8 @@ namespace cairocanvas
{
#if defined CAIRO_HAS_WIN32_SURFACE
// FIXME: Some kind of work-araound...
- cairo_rectangle (mpSurface->getCairo().get(), 0, 0, 0, 0);
- cairo_fill(mpSurface->getCairo().get());
+ cairo_rectangle (mpCairo.get(), 0, 0, 0, 0);
+ cairo_fill(mpCairo.get());
#endif
::Point aOutpos;
if( !setupTextOutput( *mpVirtualDevice, pOwner, aOutpos, viewState, renderState, xFont ) )
@@ -333,7 +333,7 @@ namespace cairocanvas
RTL_TEXTENCODING_UTF8 ).getStr());
rtl::Reference< TextLayout > pTextLayout( new TextLayout(text, textDirection, 0, CanvasFont::Reference(dynamic_cast< CanvasFont* >( xFont.get() )), mpSurfaceProvider) );
- pTextLayout->draw( mpSurface, *mpVirtualDevice, aOutpos, viewState, renderState );
+ pTextLayout->draw(mpCairo, *mpVirtualDevice, aOutpos, viewState, renderState);
}
return uno::Reference< rendering::XCachedPrimitive >(NULL);
@@ -358,8 +358,8 @@ namespace cairocanvas
{
#if defined CAIRO_HAS_WIN32_SURFACE
// FIXME: Some kind of work-araound...
- cairo_rectangle( mpSurface->getCairo().get(), 0, 0, 0, 0);
- cairo_fill(mpSurface->getCairo().get());
+ cairo_rectangle(mpCairo.get(), 0, 0, 0, 0);
+ cairo_fill(mpCairo.get());
#endif
// TODO(T3): Race condition. We're taking the font
// from xLayoutedText, and then calling draw() at it,
@@ -371,7 +371,7 @@ namespace cairocanvas
return uno::Reference< rendering::XCachedPrimitive >(NULL); // no output necessary
// TODO(F2): What about the offset scalings?
- pTextLayout->draw( mpSurface, *mpVirtualDevice, aOutpos, viewState, renderState );
+ pTextLayout->draw(mpCairo, *mpVirtualDevice, aOutpos, viewState, renderState);
}
}
else
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 8b11012..892830e 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -337,7 +337,7 @@ namespace cairocanvas
*
* @return true, if successful
**/
- bool TextLayout::draw( SurfaceSharedPtr& pSurface,
+ bool TextLayout::draw( CairoSharedPtr& pSCairo,
OutputDevice& rOutDev,
const Point& rOutpos,
const rendering::ViewState& viewState,
@@ -486,8 +486,6 @@ namespace cairocanvas
# error Native API needed.
#endif
- CairoSharedPtr pSCairo = pSurface->getCairo();
-
cairo_set_font_face( pSCairo.get(), font_face);
// create default font options. cairo_get_font_options() does not retrieve the surface defaults,
diff --git a/canvas/source/cairo/cairo_textlayout.hxx b/canvas/source/cairo/cairo_textlayout.hxx
index 4509b52..25296fc 100644
--- a/canvas/source/cairo/cairo_textlayout.hxx
+++ b/canvas/source/cairo/cairo_textlayout.hxx
@@ -81,7 +81,7 @@ namespace cairocanvas
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
- bool draw( ::cairo::SurfaceSharedPtr& pSurface,
+ bool draw( ::cairo::CairoSharedPtr& pSCairo,
OutputDevice& rOutDev,
const Point& rOutpos,
const ::com::sun::star::rendering::ViewState& viewState,
commit 5e59fe98ce4b29dd75e9d484a7f0d43b575709e8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Dec 7 11:47:10 2014 +0000
cairo_restore without matching cairo_save
Change-Id: I74496f40a532f9202e8729b8a81ef20ee86a5133
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index f2b5ddd..8b11012 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -573,14 +573,12 @@ namespace cairocanvas
OSL_TRACE(":cairocanvas::TextLayout::draw(S,O,p,v,r): FAKEBOLD - dx:%d", (int) bold_dx);
}
- cairo_restore( pSCairo.get() );
cairo_font_face_destroy(font_face);
cairo_font_options_destroy(options);
}
return true;
}
-
namespace
{
class OffsetTransformer
commit 4c6a30d53d9039066c368b9e9f6819e8594461cc
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Dec 5 09:37:24 2014 +0000
coverity#707985 Uninitialized scalar field
Change-Id: I1847b2900b513cc9b7b47767a15fb7e11d0abf26
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index 45b4a64..94bd6b1 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -143,7 +143,7 @@ struct RowInfo : boost::noncopyable
{
CellInfo* pCellInfo;
- sal_uInt16 nHeight;
+ sal_uInt16 nHeight;
SCROW nRowNo;
SCCOL nRotMaxCol; // SC_ROTMAX_NONE, if nothing
@@ -152,12 +152,6 @@ struct RowInfo : boost::noncopyable
bool bAutoFilter:1;
bool bPivotButton:1;
bool bChanged:1; // TRUE, if not tested
-
- inline explicit RowInfo() : pCellInfo( 0 ) {}
-
-private:
- RowInfo( const RowInfo& );
- RowInfo& operator=( const RowInfo& );
};
struct ScTableInfo : boost::noncopyable
@@ -169,10 +163,6 @@ struct ScTableInfo : boost::noncopyable
explicit ScTableInfo();
~ScTableInfo();
-
-private:
- ScTableInfo( const ScTableInfo& );
- ScTableInfo& operator=( const ScTableInfo& );
};
#endif
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 0811290..c2d36c0 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -1120,6 +1120,7 @@ ScTableInfo::ScTableInfo()
, mnArrCount(0)
, mbPageMode(false)
{
+ memset(mpRowInfo, 0, ROWINFO_MAX*sizeof(RowInfo));
}
ScTableInfo::~ScTableInfo()
commit fe73f2098ed9aa8bee1da5cba98353549384d642
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 4 21:08:31 2014 +0000
effectively expand init_header into member init list
this is all that init_header does anyway
Change-Id: If1607ab25b43bd313d2d2f1da65c20fc87ae7951
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index b4cb4a0..59c3981 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -65,8 +65,9 @@ namespace sw
* are alone in one.
*/
Ring()
- : pPrev(static_cast< value_type* >(this))
- { algo::init_header(static_cast< value_type* >(this)); }
+ : pNext(static_cast< value_type* >(this))
+ , pPrev(static_cast< value_type* >(this))
+ { }
/**
* Creates a new item and add it to an existing ring container.
* Note: the newly created item will be inserted just before item pRing.
@@ -120,13 +121,14 @@ namespace sw
template <typename value_type>
inline Ring<value_type>::Ring( value_type* pObj )
- : pPrev(static_cast< value_type* >(this))
+ : pNext(static_cast< value_type* >(this))
+ , pPrev(static_cast< value_type* >(this))
{
- value_type* pThis = static_cast< value_type* >(this);
- if( !pObj )
- algo::init_header(pThis);
- else
+ if( pObj )
+ {
+ value_type* pThis = static_cast< value_type* >(this);
algo::link_before(pObj, pThis);
+ }
}
template <typename value_type>
commit 46c9f1e247e0e3d16c82566783344a2389fa4543
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 4 16:40:12 2014 +0000
try and help coverity out here
wrt #3 of 1213364 Untrusted loop bound
Change-Id: I4a47d4e1d6ebca14921c7e001d28354d687968d0
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 4085e83..1adaf79 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -455,7 +455,7 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin
const sal_uInt16 palen = lastPoint+1;
//at a minimum its one byte per entry
- if (palen > nBytesRemaining)
+ if (palen > nBytesRemaining || lastPoint > nBytesRemaining-1)
{
SAL_WARN("vcl.fonts", "Font " << OUString::createFromAscii(ttf->fname) <<
"claimed a palen of "
commit 6406a2701c3eae884e967f0b80e2e8a3228d39df
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 4 16:37:30 2014 +0000
coverity#1213364 Untrusted loop bound
Change-Id: I586b9550b09a485cedd13e0e4c637f253e8eafd0
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index bd9a1fe..4085e83 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -435,8 +435,8 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin
/* determine the last point and be extra safe about it. But probably this code is not needed */
sal_uInt16 lastPoint=0;
- sal_uInt32 nOffset = 10 + numberOfContours + 2;
- if (nOffset > nTableSize)
+ const sal_Int32 nMaxContours = (nTableSize - 10)/2;
+ if (numberOfContours > nMaxContours)
return 0;
for (i=0; i<numberOfContours; i++)
{
@@ -446,7 +446,7 @@ static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoin
}
sal_uInt16 instLen = GetUInt16(ptr, 10 + numberOfContours*2, 1);
- nOffset = 10 + 2 * numberOfContours + 2 + instLen;
+ sal_uInt32 nOffset = 10 + 2 * numberOfContours + 2 + instLen;
if (nOffset > nTableSize)
return 0;
const sal_uInt8* p = ptr + nOffset;
commit 9af88a70e93ff146c264c33dae60f54c926941f7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 4 16:29:39 2014 +0000
Revert "coverity#1242942 Use of untrusted scalar value"
This reverts commit 093b3d30f257a01122042eb4d116ee54fbdb7033.
it didn't help one bit to get coverity to see the bounds check
Change-Id: Ibf01c7dea2b220290511871c2a650051295d389d
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 73c453e..1053ea7 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -1169,15 +1169,6 @@ private:
SCROW mnUBound;
};
- bool ValidCol(SCCOL nCol) const
- {
- return nCol >= 0 && static_cast<size_t>(nCol) < SAL_N_ELEMENTS(aCol);
- }
-
- bool ValidColRow(SCCOL nCol, SCROW nRow) const
- {
- return ValidCol(nCol) && ValidRow(nRow);
- }
};
#endif
commit 612ebb3a545c4886d0123326abcdb951432dc4f2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 4 16:22:46 2014 +0000
coverity#1256664 Division or modulo by float zero
and
coverity#1256664 Division or modulo by float zero
Change-Id: I62c923aad9a21b517f6422365ccf94311e0709b6
diff --git a/vcl/opengl/program.cxx b/vcl/opengl/program.cxx
index 8b92c4b..46552fd 100644
--- a/vcl/opengl/program.cxx
+++ b/vcl/opengl/program.cxx
@@ -217,14 +217,19 @@ void OpenGLProgram::SetTransform(
const basegfx::B2DPoint& rX,
const basegfx::B2DPoint& rY )
{
+ auto nTexWidth = rTexture.GetWidth();
+ auto nTexHeight = rTexture.GetHeight();
+ if (nTexWidth == 0 || nTexHeight == 0)
+ return;
+
GLuint nUniform = GetUniformLocation( rName );
const basegfx::B2DVector aXRel = rX - rNull;
const basegfx::B2DVector aYRel = rY - rNull;
const float aValues[] = {
- (float) aXRel.getX()/rTexture.GetWidth(), (float) aXRel.getY()/rTexture.GetWidth(), 0, 0,
- (float) aYRel.getX()/rTexture.GetHeight(), (float) aYRel.getY()/rTexture.GetHeight(), 0, 0,
- 0, 0, 1, 0,
- (float) rNull.getX(), (float) rNull.getY(), 0, 1 };
+ (float) aXRel.getX()/nTexWidth, (float) aXRel.getY()/nTexWidth, 0, 0,
+ (float) aYRel.getX()/nTexHeight, (float) aYRel.getY()/nTexHeight, 0, 0,
+ 0, 0, 1, 0,
+ (float) rNull.getX(), (float) rNull.getY(), 0, 1 };
glm::mat4 mMatrix = glm::make_mat4( aValues );
glUniformMatrix4fv( nUniform, 1, GL_FALSE, glm::value_ptr( mMatrix ) );
}
More information about the Libreoffice-commits
mailing list