Skip to content

Commit

Permalink
Applogy: Fix Shared Memory Overwriting (prebid#1758)
Browse files Browse the repository at this point in the history
  • Loading branch information
guscarreon authored and shunj-nb committed Nov 8, 2022
1 parent 8f9a8bf commit a356e36
Showing 1 changed file with 8 additions and 8 deletions.
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}
body, err := json.Marshal(request)
if err != nil {
errs = append(errs, err)
Expand Down

0 comments on commit a356e36

Please sign in to comment.