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

Richaudience: Shared memory fix #2710

Merged
merged 5 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions adapters/richaudience/richaudience.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
}

if request.App != nil {
appCopy := *request.App
request.App = &appCopy

request.App.Keywords = "tagid=" + imp.TagID
}

if request.Site != nil {
siteCopy := *request.Site
request.Site = &siteCopy

request.Site.Keywords = "tagid=" + imp.TagID
}

Expand Down Expand Up @@ -160,18 +166,18 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
bidResponse.Currency = bidResp.Cur

for _, reqBid := range bidReq.Imp {
for _, seatBid := range bidResp.SeatBid {
for i := range seatBid.Bid {
for j := range bidResp.SeatBid {
for i := range bidResp.SeatBid[j].Bid {

bidType := getMediaType(seatBid.Bid[i].ImpID, reqBid)
bidType := getMediaType(bidResp.SeatBid[j].Bid[i].ImpID, reqBid)

if bidType == "video" {
seatBid.Bid[i].W = reqBid.Video.W
seatBid.Bid[i].H = reqBid.Video.H
bidResp.SeatBid[j].Bid[i].W = reqBid.Video.W
bidResp.SeatBid[j].Bid[i].H = reqBid.Video.H
}

b := &adapters.TypedBid{
Bid: &seatBid.Bid[i],
Bid: &bidResp.SeatBid[j].Bid[i],
BidType: bidType,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these changes necessary for the bid processing loop? I'm not seeing the issue with the original code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are no issues with this. We discussed this with the team and decided this is the right way to do this, similar to how we access Bid by index. I can revert it back.

Copy link
Contributor

@SyntaxNode SyntaxNode Apr 24, 2023

Choose a reason for hiding this comment

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

I would recommend to revert this change. There's nothing wrong with the original code and this change is unrelated to the memory corruption.

Arguably, seatBid.Bid[i] is preferred over bidResp.SeatBid[j].Bid[i].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"bidfloor": 1e-05,
"bidfloorcur": "USD",
"tagid": "testTag",
"ext": {
"bidder": {
"pid": "OsNsyeF68q",
Expand Down Expand Up @@ -86,7 +87,7 @@
],
"app": {
"id": "12345678",
"keywords": "tagid=",
"keywords": "tagid=testTag",
"name": "Richaudience TV",
"bundle": "R12345678901011",
"publisher": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
]
},
"bidfloor": 1e-05,
"tagid": "testTag",
"ext": {
"bidder": {
"pid": "OsNsyeF68q",
Expand Down Expand Up @@ -80,7 +81,7 @@
}
],
"site": {
"keywords": "tagid=",
"keywords": "tagid=testTag",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
Expand Down