Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kraken: rgw: unsafe access in RGWListBucket_ObjStore_SWIFT::send_response() #14530

Merged
merged 1 commit into from Jul 6, 2017

Conversation

smithfarm
Copy link
Contributor

@smithfarm smithfarm self-assigned this Apr 13, 2017
@smithfarm smithfarm added this to the kraken milestone Apr 13, 2017
rgw_obj_key& key = iter->key;
if (iter != objs.end()) {
rgw_obj_key& key = iter->key;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yehudasa See question I asked you at 5cf5ab4

@smithfarm smithfarm requested a review from yehudasa April 13, 2017 20:50
Copy link
Member

@yehudasa yehudasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@smithfarm
Copy link
Contributor Author

/home/jenkins-build/build/workspace/ceph-pull-requests/src/rgw/rgw_rest_swift.cc: In member function ‘virtual void RGWListBucket_ObjStore_SWIFT::send_response()’:
/home/jenkins-build/build/workspace/ceph-pull-requests/src/rgw/rgw_rest_swift.cc:286:20: warning: unused variable ‘key’ [-Wunused-variable]
       rgw_obj_key& key = iter->key;
                    ^
/home/jenkins-build/build/workspace/ceph-pull-requests/src/rgw/rgw_rest_swift.cc:292:15: error: ‘key’ was not declared in this scope
     else if (!key.empty() && key.name.compare(pref_iter->first) == 0) {
               ^
/home/jenkins-build/build/workspace/ceph-pull-requests/src/rgw/rgw_rest_swift.cc:300:48: error: ‘key’ was not declared in this scope
     if (do_objs && (marker.empty() || marker < key)) {
                                                ^
make[3]: *** [src/rgw/CMakeFiles/rgw_a.dir/rgw_rest_swift.cc.o] Error 1

@smithfarm smithfarm changed the title kraken: rgw: unsafe access in RGWListBucket_ObjStore_SWIFT::send_response() [DNM] kraken: rgw: unsafe access in RGWListBucket_ObjStore_SWIFT::send_response() Apr 15, 2017
@smithfarm
Copy link
Contributor Author

smithfarm commented Apr 15, 2017

If I'm parsing the code correctly, the objs in this case is declared in src/rgw/rgw_op.h thusly:

vector<RGWObjEnt> objs;

And RGWObjEnt is a struct with an element key that is declared as rgw_obj_key key

In this case, I think iter->key is the actual value of key, not a reference to it.

@smithfarm smithfarm changed the title [DNM] kraken: rgw: unsafe access in RGWListBucket_ObjStore_SWIFT::send_response() kraken: rgw: unsafe access in RGWListBucket_ObjStore_SWIFT::send_response() Apr 20, 2017
Fixes: http://tracker.ceph.com/issues/19249

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit a9ec5e8)

Conflicts:
        src/rgw/rgw_rest_swift.cc ("key" element of RGWObjEnt struct
           is not a reference; fix)
@smithfarm
Copy link
Contributor Author

This PR passed an rgw suite at http://tracker.ceph.com/issues/19009#note-60

@smithfarm smithfarm merged commit 6db580b into ceph:kraken Jul 6, 2017
@smithfarm smithfarm deleted the wip-19574-kraken branch July 6, 2017 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants