-
Notifications
You must be signed in to change notification settings - Fork 314
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
[Bug]: Call serializeSessionDescriptionInit and return STATUS_BUFFER_TOO_SMALL #2019
Comments
Could you highlight what your application looks like? The API in our sample is invoked twice. Once to get the size:
buffLen is initialized to 0 in the viewer sample. In the function, the second parameter is NULL, which means nothing gets copied into
In this call, the SDK serializes the SDP. Could you attach logs and how you are invoking the APIs in your application? |
@disa6302 The point of the question is :
in the code, sessionDescriptionJSON is NULL, but *sessionDescriptionJSONLen will increase after "*sessionDescriptionJSONLen += amountWritten", and it will make the first parameter of SNPRINTF is "NOT NULL", so , i do a little change as follow and it worked :
|
Please confirm you have already done the following
Please answer the following prompt
Describe the bug
Hello, first of all, my English is poor, so please forgive me if I use inappropriate words.
When I was using the webRTC SDK, I encountered a problem that calling serializeSessionDescriptionInit returned STATUS_BUFFER_TOO_SMALL.
CHK_STATUS(serializeSessionDescriptionInit(&offerSessionDescriptionInit, NULL, &buffLen));
After debugging, it was confirmed that it was caused by snprintf. I reviewed the code and found that the function logic intended to count the number of strings through snprintf, but the first time When passed in, sessionDescriptionJSON is NULL, and when actually called, the first parameter passed in is sessionDescriptionJSON + *sessionDescriptionJSONLen, but *sessionDescriptionJSONLen will accumulate, which will cause the first parameter buffer of snprintf to be passed in non-NULL and illegal parameters. , eventually causing snprintf to return -1, and amountWritten is UINT32, triggering an error when CHK(((inputSize - *sessionDescriptionJSONLen) >= amountWritten)), causing the program to end.
Expected Behavior
The function should return the serialized string length
Current Behavior
The function return STATUS_BUFFER_TOO_SMALL
Reproduction Steps
run kvsWebRTCClientViewer.exe
WebRTC C SDK version being used
1.10.2
If it was working in a previous version, which one?
No response
Compiler and Version used
gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
Operating System and version
Windows 10
Platform being used
minGW
The text was updated successfully, but these errors were encountered: