From: Hermet Park Date: Wed, 12 Oct 2016 09:52:17 +0000 (+0900) Subject: fix a crash in UiIfaceView :: getAvailableRotations() X-Git-Tag: submit/tizen/20161013.034343^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F61%2F91961%2F3;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git fix a crash in UiIfaceView :: getAvailableRotations() don't access invalid pointer. Change-Id: Ibdbf6df6adbe9f9807ed45b80e4d8ee3ffb9a715 --- diff --git a/src/include/efl/mobile/c/ui_view.h b/src/include/efl/mobile/c/ui_view.h index 26cc5db..f19f3e5 100644 --- a/src/include/efl/mobile/c/ui_view.h +++ b/src/include/efl/mobile/c/ui_view.h @@ -204,6 +204,8 @@ EAPI int ui_view_set_available_rotations(ui_view *view, const int *rotations, un * * @return The array of rotation values * + * @warning @c NULL will be returned if @a view or @a count is invalid. + * * @see ui_view_set_available_rotations() */ EAPI const int *ui_view_get_available_rotations(ui_view *view, unsigned int *count); diff --git a/src/include/interface/UiIfaceView.h b/src/include/interface/UiIfaceView.h index 48f1578..ef48929 100644 --- a/src/include/interface/UiIfaceView.h +++ b/src/include/interface/UiIfaceView.h @@ -117,6 +117,8 @@ public: * * @return The array of rotation values. * + * @warning @c nullptr will be returned if @a count is invalid. + * * @see setAvailableRotations() */ const int *getAvailableRotations(unsigned int *count); diff --git a/src/lib/interface/UiIfaceView.cpp b/src/lib/interface/UiIfaceView.cpp index e50fb64..9f0272e 100644 --- a/src/lib/interface/UiIfaceView.cpp +++ b/src/lib/interface/UiIfaceView.cpp @@ -227,6 +227,8 @@ int UiIfaceViewImpl::setAvailableRotations(const int *rotations, unsigned int co const int *UiIfaceViewImpl::getAvailableRotations(unsigned int *count) { + if (!count) return nullptr; + static int rots[MAX_NUM_OF_AVAILABLE_ROTATIONS] = {0, 90, 180, 270}; if (this->_rotationCount > 0) {