programs/fuzz: Fixed an MSVC compilation warning #695

Open
minosgalanakis wants to merge 2 commits from minosgalanakis/bugfix/program-fuzz-mscv into development
minosgalanakis commented 2026-02-20 05:18:58 -06:00 (Migrated from github.com)

Description

Resolves Mbed-TLS/mbedtls#10604

PR checklist

Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.

  • changelog not required because: It fixes a bug in a program that is part of the library
  • framework PR not required
  • mbedtls development PR not required because: The reference program resides here
  • mbedtls 3.6 PR not required because: Offending code does not exist in the equivalent program
  • tests provided | not required because: Testing programs is outside of the scope of our framework
## Description Resolves Mbed-TLS/mbedtls#10604 ## PR checklist Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line. If the provided content is part of the present PR remove the # symbol. - [ ] **changelog** not required because: It fixes a bug in a program that is part of the library - [ ] **framework PR** not required - [ ] **mbedtls development PR** not required because: The reference program resides here - [ ] **mbedtls 3.6 PR** not required because: Offending code does not exist in the equivalent program - **tests** provided | not required because: Testing programs is outside of the scope of our framework
gilles-peskine-arm (Migrated from github.com) requested changes 2026-02-20 14:02:51 -06:00
gilles-peskine-arm (Migrated from github.com) left a comment

As attractive as it is to do a one-character fix, let's fix the actual problem instead. It will let us delete code.

As attractive as it is to do a one-character fix, let's fix the actual problem instead. It will let us delete code.
@ -23,21 +23,12 @@ int main(int argc, char **argv)
return 1;
gilles-peskine-arm (Migrated from github.com) commented 2026-02-20 14:02:02 -06:00

I would prefer to remove the Windows-specific block of code altogether. Simpler is better.

We use fopen elsewhere in the library. This is the only place where we use fopen_s, since https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/245/changes#r2834845186. In 3.6 we don't use fopen_s.

As far as I can tell, this block of code using fopen_s was added to silence a warning from MSVC which started popping up.after some changes in our header files. We have

#define _CRT_SECURE_NO_DEPRECATE 1

in tf-psa-crypto/build_info.h. (Which is wrong but that's another story.) Normally we include this before any system headers, but in this particular program we now include <stdio.h> before <tf-psa-crypto/build_info.h>, so fopen is declared as deprecated.

So please remove this Windows-specific block, and instead fix the header inclusion order. Putting fuzz_common.h before everything else is enough here.

I would prefer to remove the Windows-specific block of code altogether. Simpler is better. We use `fopen` elsewhere in the library. This is the only place where we use `fopen_s`, since https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/245/changes#r2834845186. In 3.6 we don't use `fopen_s`. As far as I can tell, this block of code using `fopen_s` was added to silence a warning from MSVC which started popping up.after some changes in our header files. We have ``` #define _CRT_SECURE_NO_DEPRECATE 1 ``` in `tf-psa-crypto/build_info.h`. ([Which is wrong](https://github.com/Mbed-TLS/mbedtls/issues/10612) but that's another story.) Normally we include this before any system headers, but in this particular program we now include `<stdio.h>` before `<tf-psa-crypto/build_info.h>`, so `fopen` is declared as deprecated. So please remove this Windows-specific block, and instead fix the header inclusion order. Putting `fuzz_common.h` before everything else is enough here.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'minosgalanakis/bugfix/program-fuzz-mscv:minosgalanakis/bugfix/program-fuzz-mscv'
git switch 'minosgalanakis/bugfix/program-fuzz-mscv'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'development'
git merge --no-ff 'minosgalanakis/bugfix/program-fuzz-mscv'
git switch 'minosgalanakis/bugfix/program-fuzz-mscv'
git rebase 'development'
git switch 'development'
git merge --ff-only 'minosgalanakis/bugfix/program-fuzz-mscv'
git switch 'minosgalanakis/bugfix/program-fuzz-mscv'
git rebase 'development'
git switch 'development'
git merge --no-ff 'minosgalanakis/bugfix/program-fuzz-mscv'
git switch 'development'
git merge --squash 'minosgalanakis/bugfix/program-fuzz-mscv'
git switch 'development'
git merge --ff-only 'minosgalanakis/bugfix/program-fuzz-mscv'
git switch 'development'
git merge 'minosgalanakis/bugfix/program-fuzz-mscv'
git push origin 'development'
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto!695
No description provided.