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

Applogy: Fix Shared Memory Overwriting #1758

Merged
merged 3 commits into from
Mar 22, 2021
Merged
Changes from all 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
16 changes: 8 additions & 8 deletions adapters/applogy/applogy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E
result := make([]*adapters.RequestData, 0, len(impressions))
errs := make([]error, 0, len(impressions))

for i, impression := range impressions {
for _, impression := range impressions {
if impression.Banner == nil && impression.Video == nil && impression.Native == nil {
errs = append(errs, &errortypes.BadInput{
Message: "Applogy only supports banner, video or native ads",
})
continue
}
if impression.Banner != nil {
banner := impression.Banner
if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 {
if len(banner.Format) == 0 {
if impression.Banner.W == nil || impression.Banner.H == nil || *impression.Banner.W == 0 || *impression.Banner.H == 0 {
if len(impression.Banner.Format) == 0 {
errs = append(errs, &errortypes.BadInput{
Message: "banner size information missing",
})
continue
}
format := banner.Format[0]
banner.W = &format.W
banner.H = &format.H
banner := *impression.Banner
banner.W = openrtb.Uint64Ptr(banner.Format[0].W)
banner.H = openrtb.Uint64Ptr(banner.Format[0].H)
impression.Banner = &banner
}
}
if len(impression.Ext) == 0 {
Expand All @@ -70,7 +70,7 @@ func (a *ApplogyAdapter) MakeRequests(request *openrtb.BidRequest, _ *adapters.E
errs = append(errs, errors.New("Applogy token required"))
continue
}
request.Imp = impressions[i : i+1]
request.Imp = []openrtb.Imp{impression}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this the best approach for this adapter. Based on the request.Imp = impressions line later in this adapter, it seems their intent is to preserve the bid request. Any other approach would not accomplish that goal.

body, err := json.Marshal(request)
if err != nil {
errs = append(errs, err)
Expand Down