-
Karthik Kamath authored
VARIABLE ANALYSIS: ========= In the function my_b_vprintf() which is used for logging in MySQL, there is an unintended usage of 'precision' variable. my_b_printf() which is wrapper for my_b_vprintf() is a simple version of printf(). Generally in printf() statements, we use an asterisk (*) to denote the width specifier/precision instead of hard coding it in the format string. The value for '*' is passed as an additional integer value argument to printf(), preceding the argument that has to be formatted. To achieve the required formatting, we use two variables which are defined below. - minimum_width (currently implemented for %d and %u): The minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. - precision (currently implemented for %b, binary buffer): used to print exactly <precision> bytes from the argument without stopping at '\0'. In the current implementation, 'precision' was used for processing '*' which should ideally be used only for processing '.*'. This might result in data loss. FIX: ==== We are now using the variable 'precision' for processing of '.*' and 'minimum_width' for processing of '*'.
Karthik Kamath authoredVARIABLE ANALYSIS: ========= In the function my_b_vprintf() which is used for logging in MySQL, there is an unintended usage of 'precision' variable. my_b_printf() which is wrapper for my_b_vprintf() is a simple version of printf(). Generally in printf() statements, we use an asterisk (*) to denote the width specifier/precision instead of hard coding it in the format string. The value for '*' is passed as an additional integer value argument to printf(), preceding the argument that has to be formatted. To achieve the required formatting, we use two variables which are defined below. - minimum_width (currently implemented for %d and %u): The minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. - precision (currently implemented for %b, binary buffer): used to print exactly <precision> bytes from the argument without stopping at '\0'. In the current implementation, 'precision' was used for processing '*' which should ideally be used only for processing '.*'. This might result in data loss. FIX: ==== We are now using the variable 'precision' for processing of '.*' and 'minimum_width' for processing of '*'.
Loading