Replies: 4 comments 7 replies
-
According to Copilot (not always assuming it is correct, but I think this one is, and it doesn't have a solution either):
|
Beta Was this translation helpful? Give feedback.
-
That answer seems roughly correct. Though I haven't actually looked at the code to see under what circumstances this could be a problem. Could you please provide a reproduction recipe to see what fails and how? Why and how would one want to upload a zero byte object anyway? It doesn't make sense to read anything that has no content. |
Beta Was this translation helpful? Give feedback.
-
Don't have a recipe I cn share quickly. But our application has a dynamic sized payload, which at times no data is available, will send a 0-sized bytearray. For now we use an 'if zero then' construction. (sorry for the long delay, I didn't get the notifications from github..) |
Beta Was this translation helpful? Give feedback.
-
Created a test that triggers the fault: add test below in test_local.py, TestSDO class, and add a breakpoint in sdo/client.py at line 256 (
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
canopen/canopen/sdo/server.py
Line 72:
res_command |= (4 - size) << 2
will generate a number of bytes not filled with data, in case of data size 0, it will result in n=4-0, n=4. But n should fit in bits 2..3 of the COB, it doesn't fit in 2 bits, as n in this case is 3 bits.
Is this a bug, if yes: what should the server send as a correct response?
Beta Was this translation helpful? Give feedback.
All reactions