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

Commit 8d53fbb

Browse files
author
Guihao Liang
authored
prevent from reading null (#3115)
* prevent from reading nullptr
1 parent 8d6215f commit 8d53fbb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/core/storage/sframe_interface/unity_sframe.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,8 @@ void unity_sframe::delete_on_close() {
18561856
}
18571857

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

src/python/turicreate/test/test_io_s3.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,20 @@ def test_s3_sframe_upload(self, folder):
129129
# we can trust the upload becuase if the upload fails,
130130
# s3 will respond with 5xx
131131

132+
@pytest.mark.parametrize(
133+
"url",
134+
["s3://gui/dummy", "./willy-nily/blah", "https://foo.com", "http://hao.com"],
135+
)
136+
def test_s3_sframe_load_from_wrong_path(self, url):
137+
# s3 only writes when it receives all parts
138+
# it's sort of atmoic write on file level.
139+
if six.PY2:
140+
with pytest.raises(IOError):
141+
SFrame(url)
142+
else:
143+
with pytest.raises(OSError):
144+
SFrame(url)
145+
132146
def test_s3_sframe_upload_throw(self):
133147
# s3 only writes when it receives all parts
134148
# it's sort of atmoic write on file level.

0 commit comments

Comments
 (0)