待辦事項 #45917

fc_rand(): 'do { ... } while (size > 1)' run once for size == 1

啟用日期: 2022-10-18 17:37 最後更新: 2023-04-09 18:00

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
修正
檔案:
2

細節

fc_rand() (actually fc_rand_debug() ) is not supposed to do any work for (size <= 1), as it even has a comment about initializing stuff for such size:

/*
* These assignments are only here to make the compiler
* happy. Since each usage is guarded with a if (size > 1).
*/

But the loop there is a "do ... while()" one, so it always execute once.

Ticket History (3/10 Histories)

2022-10-18 17:37 Updated by: cazfi
  • New Ticket "fc_rand(): 'do { ... } while (size > 1)' run once for size == 1" created
2022-12-05 00:20 Updated by: cazfi
2023-01-30 13:00 Updated by: cazfi
2023-03-25 12:35 Updated by: cazfi
  • 負責人 Update from (無) to cazfi
  • 處理結果 Update from to Accepted
2023-03-25 12:43 Updated by: cazfi
評語

This means that fc_rand(1) (or fc_rand(0) ) no longer change the random state at all. While it's unlikely that anything has relied on the old behavior of any fc_rand() call to change random state, it's possible that this reveals some subtle bug.

2023-03-27 11:56 Updated by: cazfi
評語

Reply To cazfi

it's possible that this reveals some subtle bug.

With risk like this, and issue being fixed being so minor -> not to 3.0.7 in the last minute.

2023-04-01 13:49 Updated by: cazfi
評語

Pushed to branches other than S3_0. S3_0 waiting for 3.0.7 release.

2023-04-09 18:00 Updated by: cazfi
  • 狀態 Update from 開啟 to 關閉
  • 處理結果 Update from Accepted to 修正

Attachment File List

編輯

Please login to add comment to this ticket » 登入