Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
prevent from reading null (#3115)
Browse files Browse the repository at this point in the history
* prevent from reading nullptr
  • Loading branch information
Guihao Liang authored Apr 13, 2020
1 parent 8d6215f commit 8d53fbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/storage/sframe_interface/unity_sframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,8 @@ void unity_sframe::delete_on_close() {
}

std::shared_ptr<planner_node> unity_sframe::get_planner_node() {
ASSERT_MSG(m_planner_node != nullptr,
"Unintialized SFrame planner node cannot be used for read");
return m_planner_node;
}

Expand Down
14 changes: 14 additions & 0 deletions src/python/turicreate/test/test_io_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,20 @@ def test_s3_sframe_upload(self, folder):
# we can trust the upload becuase if the upload fails,
# s3 will respond with 5xx

@pytest.mark.parametrize(
"url",
["s3://gui/dummy", "./willy-nily/blah", "https://foo.com", "http://hao.com"],
)
def test_s3_sframe_load_from_wrong_path(self, url):
# s3 only writes when it receives all parts
# it's sort of atmoic write on file level.
if six.PY2:
with pytest.raises(IOError):
SFrame(url)
else:
with pytest.raises(OSError):
SFrame(url)

def test_s3_sframe_upload_throw(self):
# s3 only writes when it receives all parts
# it's sort of atmoic write on file level.
Expand Down

0 comments on commit 8d53fbb

Please sign in to comment.