github-vet / github-vet/rangeloop-pointer-findings
ricktian1226/BatteryRun: MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_transaction_server/business/xyapi_iapvalidate.go; 51 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ricktian1226/BatteryRun](https://www.github.com/ricktian1226/BatteryRun) at [MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_transaction_server/business/xyapi_iapvalidate.go](https://github.com/ricktian1226/BatteryRun/blob/c5176485339a69271b83a23982801a67b443c7c1/MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_transaction_server/business/xyapi_iapvalidate.go#L136-L186)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
>
[Click here to see the code in its original context.](https://github.com/ricktian1226/BatteryRun/blob/c5176485339a69271b83a23982801a67b443c7c1/MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_transaction_server/business/xyapi_iapvalidate.go#L136-L186)
Click here to show the 51 line(s) of Go which triggered the analyzer.
```go
for _, transaction := range iapTransactions {
transaction.Uid = proto.String(uid)
transaction.OpDate = proto.String(opDate)
transaction.Timestamp = proto.Int64(now)
xylog.Debug(uid, "transaction info : %v", &transaction)
//1.00.00以前的客户端,需要在对收据内的transaction遍历时进行防重放校验
tid := transaction.GetTransactionId()
if bOldStyle {
isExist, err = api.GetDB(xybusiness.BUSINESS_COLLECTION_INDEX_IAPTRANSACTION).IsTransactionExsit(tid)
if err != xyerror.ErrOK || err != xyerror.ErrNotFound {
subFailReason = xyerror.IAP_DB_ERROR
bKick = true
xylog.Error(uid, "verify receipt db error: %v", err)
} else if isExist {
subFailReason = xyerror.IAP_SUCCESS
bKick = true
xylog.Warning(uid, "verify receipt transactionid [%s] already exists in DB.iaptransaction", tid)
}
//如果交易被过滤掉了,添加到返回结果中
if bKick {
api.appendTransactionItem(tid, subFailReason, &(resp.Items))
continue
}
}
err = api.GetDB(xybusiness.BUSINESS_COLLECTION_INDEX_IAPTRANSACTION).AddIapTransaction(&transaction)
xylog.Debug(uid, "IapTransaction %v", &transaction)
// 查询购买的商品属性
moneygoods = xybusinesscache.DefGoodsCacheManager.IapGood(transaction.GetItemId())
if moneygoods == nil {
xylog.Error(uid, "[%s] [IapValidate] get iapgood(%s) info err: %v", uid, transaction.GetItemId(), err)
api.appendTransactionItem(transaction.GetTransactionId(), xyerror.IAP_INVALID_GOODS, &(resp.Items))
continue
}
// 扫尾工作:增加物品
xylog.Debug(uid, "add MoneyGoods %v", moneygoods)
//err = api.GainProps(uid, accountWithFlag, moneygoods.GetItems(), ACCOUNT_UPDATE_NO_DELAY, battery.MoneySubType_iap)
err = api.GainProps(uid, nil, moneygoods.GetItems(), ACCOUNT_UPDATE_NO_DELAY, battery.MoneySubType_iap)
if err == xyerror.ErrOK {
api.SendIapStatistic(uid, transaction.GetItemId(), tid)
}
//记录该条交易结果
api.appendTransactionItem(transaction.GetTransactionId(), xyerror.IAP_SUCCESS, &(resp.Items))
resp.GoodsList = append(resp.GoodsList, moneygoods.GetId())
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {Debug 3} was not found in the callgraph; reference was passed directly to third-party code
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: c5176485339a69271b83a23982801a67b443c7c1
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.