Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asar-tests: fix -Wformat-truncation warning #312

Merged
merged 1 commit into from
Mar 2, 2024

Conversation

orbea
Copy link
Contributor

@orbea orbea commented Mar 2, 2024

Gentoo considers this warning to be a QA issue for the ebuild and prints an additional warning.

Please review for correctness, I don't think these need to be 512 and the tests work fine on my end.

/tmp/asar/src/asar-tests/test.cpp: In function 'int main(int, char**)':
/tmp/asar/src/asar-tests/test.cpp:1019:44: warning: '%s' directive output may be truncated writing up to 511 bytes into a region of size between 381 and 892 [-Wformat-truncation=]
 1019 |                                 " \"%s\" \"%s\"",
      |                                            ^~
 1020 |                                 asar_exe_path, base_path, fname, out_rom_name);
      |                                                                  ~~~~~~~~~~~~
/tmp/asar/src/asar-tests/test.cpp:1015:33: note: 'snprintf' output 134 or more bytes (assuming 1156) into a destination of size 1024
 1015 |                         snprintf(cmd, sizeof(cmd),
      |                         ~~~~~~~~^~~~~~~~~~~~~~~~~~
 1016 |                                 "\"%s\" -I\"%s\" -Dcli_only=\\$1 -Dcmddefined -D!cmddefined2= --define \" !cmddefined3 = 16,240,224 \""
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1017 |                                 // RPG Hacker: 日本語������ǵ in UTF-8
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1018 |                                 " -Dcmdl_define_utf8=\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e\xf0\x9f\x87\xaf\xf0\x9f\x87\xb5"
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1019 |                                 " \"%s\" \"%s\"",
      |                                 ~~~~~~~~~~~~~~~~~
 1020 |                                 asar_exe_path, base_path, fname, out_rom_name);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/tmp/asar/src/asar-tests/test.cpp: In function 'int main(int, char**)':
/tmp/asar/src/asar-tests/test.cpp:1019:44: warning: '%s' directive output may be truncated writing up to 511 bytes into a region of size between 381 and 892 [-Wformat-truncation=]
 1019 |                                 " \"%s\" \"%s\"",
      |                                            ^~
 1020 |                                 asar_exe_path, base_path, fname, out_rom_name);
      |                                                                  ~~~~~~~~~~~~
/tmp/asar/src/asar-tests/test.cpp:1015:33: note: 'snprintf' output 134 or more bytes (assuming 1156) into a destination of size 1024
 1015 |                         snprintf(cmd, sizeof(cmd),
      |                         ~~~~~~~~^~~~~~~~~~~~~~~~~~
 1016 |                                 "\"%s\" -I\"%s\" -Dcli_only=\\$1 -Dcmddefined -D!cmddefined2= --define \" !cmddefined3 = 16,240,224 \""
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1017 |                                 // RPG Hacker: 日本語������ǵ in UTF-8
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1018 |                                 " -Dcmdl_define_utf8=\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e\xf0\x9f\x87\xaf\xf0\x9f\x87\xb5"
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1019 |                                 " \"%s\" \"%s\"",
      |                                 ~~~~~~~~~~~~~~~~~
 1020 |                                 asar_exe_path, base_path, fname, out_rom_name);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@randomdude999
Copy link
Collaborator

this entire test runner is gone in 2.0, but doesn't hurt to merge it i guess

(edit: oh hm it's not actually deleted. i think i've now rewritten all of its functionality though, so should be fine to delete)

@randomdude999 randomdude999 merged commit 73bec0f into RPGHacker:asar_2_beta Mar 2, 2024
3 checks passed
@randomdude999
Copy link
Collaborator

....oh whoops, i thought you targeted this against asar_19. i'll cherry-pick it into there, and possibly soon delete this runner

@orbea orbea deleted the format-truncation branch March 2, 2024 14:42
@orbea
Copy link
Contributor Author

orbea commented Mar 2, 2024

....oh whoops, i thought you targeted this against asar_19. i'll cherry-pick it into there, and possibly soon delete this runner

Thanks, I saw the warning in both places so I decided to do it in the asar_2_beta first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants