motion-logger: Do not use value passed unchecked to access array#3829
motion-logger: Do not use value passed unchecked to access array#3829smoe wants to merge 1 commit intoLinuxCNC:2.9from
Conversation
|
IIRC, axis checks should also check the mask because you have, for example, XZA configs where Y-axis is effectively invalid. But you need to have access to the axis_mask in trajectory stat, The checks could also be slightly simplified as: // valid: zero inclusive, max exclusive
if (joint >= 0 && joint < EMCMOT_MAX_JOINTS) {
// valid, use joint as index
} else {
log_print("...invalid joint index %d. Valid range [0,%d]\n", joint, EMCMOT_MAX_JOINTS-1);
}And, why do you split lines on closing curly brace and an else clause? You'd normally write that as: if (bla) {
something();
} else { // <-- this line
something_else();
} |
|
Wrt formatting I still hope this will soon get resolved in an automated manner. In R, I do as you suggested, in C/C++ not :-) I do not know how that logger is ultimately used. But from looking over that file I tend to get the impression that it should be autogenerated from some abstract description of all these commands. |
There are at least a couple of tests that check using motion-logger (see
While I agree in principle, the practicalities are not necessarily on our side. The whole emcmot* stuff is used in RT/non-RT communication. You can't just change the interface without changing the code on both sides of the interface. So, any generated stuff needs careful manual work on both sides to fit again. |
|
The translations apparently do not build on bullseye because of an outdated po4a. If it is not ultimately urgent then I suggest to backport the latest po4a to bullseye-backports. And then we see - should be doable. |
Please kindly have an extra eye on me setting <,<=,> correctly. Maybe these checks are not required because those checks are already performed elsewhere. Still, it feels weird to not perform such checks. The major question though is if enough is done if any such invalid number is observed.