intel / fpga-runtime-for-opencl

Intel® FPGA Runtime for OpenCL™ Software Technology
Other
34 stars 68 forks source link

Handle printf format as the last item in the format string #372

Closed mendell27 closed 3 months ago

mendell27 commented 4 months ago

The code in l_dump_printf_buffer incorrectly assumes that each printf %format in a format string is followed by at least one character. In the case of printf("%d", 10);, this is not the case, and the code will not print the value.

The fix is to exit only when the format string has been processed and there is no conversion to be done. Note that most printf formats end with an \n, so this problem doesn't occur.