awslabs / amazon-kinesis-video-streams-webrtc-sdk-c

Amazon Kinesis Video Streams Webrtc SDK is for developers to install and customize realtime communication between devices and enable secure streaming of video, audio to Kinesis Video Streams.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/group__PublicMemberFunctions.html
Apache License 2.0
1.04k stars 317 forks source link

fix bug 32 bit system reading 8 bytes for pointer results in overwriting 4 bytes of payloadType when writing rtpMapValue #2033

Closed hassanctech closed 3 months ago

hassanctech commented 4 months ago

Issue #, if available: https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/issues/2025

What was changed? In the case viewer does not support a codec the master supports on 32 bit issues a bug was fixed which could cause a garbage value to be set in the sdp answer for the rtpmap attribute.

Why was it changed? Customer reported issue, results in incorrect/buggy behavior

How was it changed? The hashTableGet fills in a UINT64 so it is expecting 8 bytes, a char* was being cast to this, but a pointer on a 32 bit system is only 4 bytes wide. This was resolved by creating an intermediate 64 bit int to hold the value then cast it back down.

What testing was done for the changes? Will request customer to test and confirm. If I can get my hands on a 32 bit system I will try it out. Linter that check's the PR description was modified to just use the linux utility wc. Otherwise the current check breaks if you have any special characters in the description, since the description supports markdown there are many characters that when present would previously report a 0 char count when in fact they were not 0. I tested the commands in my shell to confirm.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.