bazaarvoice / bv-ios-swift-sdk

Bazaarvoice's Swift SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decoding error relevant to UInt16 used in BVConversationsQueryMetaData

mustang11 opened this issue · comments

The Problem

For any query that returning a large number of results, typically BVReview, when total results value is larger than 65536, the query would fail due to an unhandled decoding error.

Steps to Reproduce

Query any product review data that has more than 65,536 records.

Expected Behavior

The query should succeed when total results is larger than total 65536

Environment

  • Specific BVSwift submodule that exhibits the issue:
    Conversations
  • BVSwift version (or git revision) that exhibits the issue:
    master
  • Last BVSwift version that did not exhibit the issue (if applicable):
    None
  • iOS version that exhibits the issue:
    Any version
  • Last iOS version that exhibits the issue (if applicable):
  • Xcode version:
    15.2
  • iOS Mobile SDK version build for under test:
    1.12.0
  • Real device or simulator:
    Both

Details

UInt16 is used in the following properties of protocol BVConversationsQueryMetaData

  • offset
  • totalResults

Once the value from JSON response is larger than 65,536 - the upper bound of UInt16, there would be an integer overflow error raising from Decoder.

UInt should be used instead to prevent this issue.

Link to BVSwift Logs

N/A

Code To Reproduce Issue [ Very Good To Have ]

N/A