You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In IVI based APIs, the way clients retrieve strings is by calling the function to get the size, allocating, then calling again with the actual buffer (aka "the IVI Dance").
It is being done incorrectly: the recursive session lock isn't grabbed, so it is possible for the size of the string to grow between the time in which the size is queried and the time in which the string is copied onto the client buffer.
There are two ways to fix it:
Acquire the session lock. This is how NI's own C# and Python APIs do it internally.
Keep growing the buffer in a loop until it's big enough, which is usually just the one time. This is how NI's own Digital Pattern Editor does it internaly.
Fixes a race condition if the size of a buffer changes between the initial sizing call and the "real" call afterwards.
This code assumes that if you pass in too small a buffer to a vanilla `ivi-dance` method it either returns the necessary size, or returns `kErrorReadBufferTooSmall`. For `ivi-dance-with-a-twist` methods, passing in too small a buffer will return `kErrorReadBufferTooSmall`.
See code in https://github.com/ni/grpc-device/blob/main/generated/nidcpower/nidcpower_service.cpp#L2400
In IVI based APIs, the way clients retrieve strings is by calling the function to get the size, allocating, then calling again with the actual buffer (aka "the IVI Dance").
It is being done incorrectly: the recursive session lock isn't grabbed, so it is possible for the size of the string to grow between the time in which the size is queried and the time in which the string is copied onto the client buffer.
There are two ways to fix it:
AB#1579918
The text was updated successfully, but these errors were encountered: