include/sfx2/dinfdlg.hxx | 5 +++-- registry/source/reflcnst.hxx | 23 ++++++++++++++--------- sfx2/source/dialog/dinfdlg.cxx | 24 +++++++++++++++++++----- vcl/source/window/window.cxx | 2 ++ 4 files changed, 38 insertions(+), 16 deletions(-)
New commits: commit d8bc093dd07ceba42c9d722e7ccca4caedbd91e4 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 29 16:00:18 2014 +0000 need to initialize mnRefCnt all sorts of things crash, e.g. format->properties Change-Id: Ida4fb97dcdddd7adde4b98fa67b107a514eef615 diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index a8617ae..606a4f5 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1187,6 +1187,8 @@ void Window::ImplInitWindowData( WindowType nType ) // it will not *be* an OutputDevice mpOutputDevice = (OutputDevice*)this; + mnRefCnt = 0; + mpWindowImpl = new WindowImpl( nType ); meOutDevType = OUTDEV_WINDOW; commit f0ffe0c063c8fe32758d77c83f773821ac185ba0 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 29 13:20:13 2014 +0000 Resolves: fdo#85111 put a border around the custom properties box Change-Id: Ibdbfb4a88c1c75aaf5d33672d8639a9ea55afbac diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index a70b5ee..340681a 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -465,9 +465,10 @@ public: // class CustomPropertiesControl ----------------------------------------- -class CustomPropertiesControl : public VclVBox +class CustomPropertiesControl : public vcl::Window { private: + VclVBox* m_pVBox; HeaderBar* m_pHeaderBar; VclHBox* m_pBody; CustomPropertiesWindow* m_pPropertiesWin; @@ -490,7 +491,7 @@ public: GetCustomProperties() const { return m_pPropertiesWin->GetCustomProperties(); } void Init(VclBuilderContainer& rParent); - virtual void setAllocation(const Size &rAllocation) SAL_OVERRIDE; + virtual void Resize() SAL_OVERRIDE; }; // class SfxCustomPropertiesPage ----------------------------------------- diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index d6a2a6e..b69a9d6 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1985,7 +1985,8 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c } CustomPropertiesControl::CustomPropertiesControl(vcl::Window* pParent) - : VclVBox(pParent) + : Window(pParent, WB_HIDE | WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL | WB_BORDER) + , m_pVBox(NULL) , m_pHeaderBar(NULL) , m_pBody(NULL) , m_pPropertiesWin(NULL) @@ -1996,8 +1997,9 @@ CustomPropertiesControl::CustomPropertiesControl(vcl::Window* pParent) void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder) { - m_pHeaderBar = new HeaderBar(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER); - m_pBody = new VclHBox(this); + m_pVBox = new VclVBox(this); + m_pHeaderBar = new HeaderBar(m_pVBox, WB_BUTTONSTYLE | WB_BOTTOMBORDER); + m_pBody = new VclHBox(m_pVBox); FixedText* pName = rBuilder.get<FixedText>("name"); FixedText* pType = rBuilder.get<FixedText>("type"); FixedText* pValue = rBuilder.get<FixedText>("value"); @@ -2012,6 +2014,12 @@ void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder) set_expand(true); set_fill(true); + m_pVBox->set_hexpand(true); + m_pVBox->set_vexpand(true); + m_pVBox->set_expand(true); + m_pVBox->set_fill(true); + m_pVBox->Show(); + m_pBody->set_hexpand(true); m_pBody->set_vexpand(true); m_pBody->set_expand(true); @@ -2048,9 +2056,14 @@ void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder) m_pVertScroll->SetScrollHdl( aScrollLink ); } -void CustomPropertiesControl::setAllocation(const Size &rAllocation) +void CustomPropertiesControl::Resize() { - VclVBox::setAllocation(rAllocation); + Window::Resize(); + + if (!m_pVBox) + return; + + m_pVBox->SetSizePixel(GetSizePixel()); bool bWidgetsResized = m_pPropertiesWin->InitControls( m_pHeaderBar, m_pVertScroll ); sal_Int32 nScrollOffset = m_pPropertiesWin->GetLineHeight(); @@ -2075,6 +2088,7 @@ CustomPropertiesControl::~CustomPropertiesControl() delete m_pPropertiesWin; delete m_pBody; delete m_pHeaderBar; + delete m_pVBox; } IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar ) commit 6484bf5f3f33a62670a29bf9a1f08bf62b64f145 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 29 11:04:40 2014 +0000 untaint registry data by using a byte-swapping pattern that coverity doesn't detect as such tested as a scratch coverity attempt with a smaller project which has a far higher allocation of coverity attempts per week :-) unsigned int readTaintedUINT32(const char* buffer) { unsigned int v = ( (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | (buffer[3] << 0) ); return v; } unsigned int readUntaintedUINT32(const char* p) { unsigned int v = *p++; v <<= 8; v |= *p++; v <<= 8; v |= *p++; v <<= 8; return v | *p; } void foo(char *buffer) { char *pOne = new char[readTaintedUINT32(buffer)]; // ^ coverity only reports this delete [] pOne; char *pTwo = new char[readUntaintedUINT32(buffer)]; // ^ and not this delete [] pTwo; } should silence coverity#1213371 Untrusted value as argument coverity#1213372 Untrusted value as argument coverity#1213373 Use of untrusted scalar value coverity#1213374 Use of untrusted scalar value coverity#1213376 Untrusted loop bound coverity#1213388 Use of untrusted scalar value coverity#1213389 Use of untrusted scalar value coverity#1213390 Use of untrusted scalar value coverity#1213423 Untrusted value as argument coverity#1213424 Untrusted value as argument coverity#1213425 Untrusted value as argument coverity#1213432 Untrusted value as argument coverity#1215304 Untrusted loop bound Change-Id: Ib8c7fc9a8e8b36ca227c76577d991c10df7dcd5a diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx index b76475e..e9e3944 100644 --- a/registry/source/reflcnst.hxx +++ b/registry/source/reflcnst.hxx @@ -138,8 +138,12 @@ inline sal_uInt32 writeUINT16(sal_uInt8* buffer, sal_uInt16 v) inline sal_uInt32 readUINT16(const sal_uInt8* buffer, sal_uInt16& v) { - v = ((buffer[0] << 8) | (buffer[1] << 0)); - + //This is untainted data which comes from a controlled source + //so, using a byte-swapping pattern which coverity doesn't + //detect as such + //http://security.coverity.com/blog/2014/Apr/on-detecting-heartbleed-with-static-analysis.html + v = *buffer++; v <<= 8; + v |= *buffer; return sizeof(sal_uInt16); } @@ -177,13 +181,14 @@ inline sal_uInt32 writeUINT32(sal_uInt8* buffer, sal_uInt32 v) inline sal_uInt32 readUINT32(const sal_uInt8* buffer, sal_uInt32& v) { - v = ( - (buffer[0] << 24) | - (buffer[1] << 16) | - (buffer[2] << 8) | - (buffer[3] << 0) - ); - + //This is untainted data which comes from a controlled source + //so, using a byte-swapping pattern which coverity doesn't + //detect as such + //http://security.coverity.com/blog/2014/Apr/on-detecting-heartbleed-with-static-analysis.html + v = *buffer++; v <<= 8; + v |= *buffer++; v <<= 8; + v |= *buffer++; v <<= 8; + v |= *buffer; return sizeof(sal_uInt32); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits