Skip to content

Commit f5ea624

Browse files
osdc: Update CB_ObjectOperation_decodevals and CB_ObjectOperation_decodekeys to persist temp val
The callback object would create a local variable then save the address of the local variable in the object which will later be referenced. This leads to access stack memory that is no longer in scope, possibly not even in the same thread. Fixes: https://tracker.ceph.com/issues/72403 Signed-off-by: Edwin Rodriguez <[email protected]>
1 parent bafdbd6 commit f5ea624

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/osdc/Objecter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ struct ObjectOperation {
673673
struct CB_ObjectOperation_decodevals {
674674
uint64_t max_entries;
675675
Vals* pattrs;
676+
Vals ignore;
676677
bool* ptruncated;
677678
int* prval;
678679
boost::system::error_code* pec;
@@ -691,7 +692,6 @@ struct ObjectOperation {
691692
if (pattrs)
692693
decode(*pattrs, p);
693694
if (ptruncated) {
694-
Vals ignore;
695695
if (!pattrs) {
696696
decode(ignore, p);
697697
pattrs = &ignore;
@@ -718,6 +718,7 @@ struct ObjectOperation {
718718
struct CB_ObjectOperation_decodekeys {
719719
uint64_t max_entries;
720720
Keys* pattrs;
721+
Keys ignore;
721722
bool *ptruncated;
722723
int *prval;
723724
boost::system::error_code* pec;
@@ -736,7 +737,6 @@ struct ObjectOperation {
736737
if (pattrs)
737738
decode(*pattrs, p);
738739
if (ptruncated) {
739-
Keys ignore;
740740
if (!pattrs) {
741741
decode(ignore, p);
742742
pattrs = &ignore;

0 commit comments

Comments
 (0)