On Fri, 6 Nov 2020 06:39:04 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Adjust millisecond format.
>
> src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c line 84:
> 
>> 82:     // Truncate milliseconds in buffer large enough to hold the
>> 83:     // value which is always < 1000 (and so a maximum of 3 digits for 
>> "%.3s")
>> 84:     char tmp[10 + 1];
> 
> I was wrong yesterday. Max len of %d would be 11 chars (if INT_MIN). Can you 
> make this buffer 11 chars please? 
> 
> (This error would have had no practical consequence: tmp[] would be filled to 
> the brim, leaving out the terminating zero, and since we then print with 
> %.3s, this would have had no negative effect. But its still better to plan 
> for \0 explicitly)

> INT_MIN = "-2147483647" = 11
If millisecs is unsigned do we not  have to account for the minus sign?

Why can't tmp just be 20 and we don't have to count characters since snprintf 
will null terminate it?

-------------

PR: https://git.openjdk.java.net/jdk/pull/1067

Reply via email to