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

Beachfront: Fix Shared Memory Overwriting #1762

Merged
merged 2 commits into from
Mar 22, 2021
Merged
Changes from 1 commit
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
19 changes: 13 additions & 6 deletions adapters/beachfront/beachfront.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,22 +407,28 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, []
bfReqs[i].Request = *request
var secure int8

var deviceCopy *openrtb.Device
if bfReqs[i].Request.Device == nil {
bfReqs[i].Request.Device = &openrtb.Device{}
deviceCopy = &openrtb.Device{}
} else {
device := *bfReqs[i].Request.Device
deviceCopy = &device
}

if beachfrontExt.VideoResponseType == "nurl" {
bfReqs[i].VideoResponseType = "nurl"
} else {
bfReqs[i].VideoResponseType = "adm"

if bfReqs[i].Request.Device.IP == "" {
bfReqs[i].Request.Device.IP = fakeIP
if deviceCopy.IP == "" {
deviceCopy.IP = fakeIP
}
}

if bfReqs[i].Request.Site != nil && bfReqs[i].Request.Site.Domain == "" && bfReqs[i].Request.Site.Page != "" {
bfReqs[i].Request.Site.Domain = getDomain(bfReqs[i].Request.Site.Page)
siteCopy := *bfReqs[i].Request.Site
siteCopy.Domain = getDomain(bfReqs[i].Request.Site.Page)
bfReqs[i].Request.Site = &siteCopy
secure = isSecure(bfReqs[i].Request.Site.Page)
}

Expand All @@ -437,10 +443,11 @@ func getVideoRequests(request *openrtb.BidRequest) ([]beachfrontVideoRequest, []
}
}

if bfReqs[i].Request.Device != nil && bfReqs[i].Request.Device.DeviceType == 0 {
if deviceCopy != nil && deviceCopy.DeviceType == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not possible for deviceCopy to be nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I noticed, left the check anyways but I can remove

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. Might as well clean that up while we're here. Likely left over from an older implementation.

// More fine graned deviceType methods will be added in the future
bfReqs[i].Request.Device.DeviceType = fallBackDeviceType(request)
deviceCopy.DeviceType = fallBackDeviceType(request)
}
bfReqs[i].Request.Device = deviceCopy

imp := request.Imp[i]

Expand Down