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

Always include crypt.h header for crypt function #1

Merged
merged 1 commit into from Feb 16, 2018

Conversation

mtasaka
Copy link
Collaborator

@mtasaka mtasaka commented Feb 15, 2018

(オリジナルのJDもですが)Fedora 28でビルドが通らないのでその修正です。

glibc 2.27 deprecated libcrypt and Fedora 28 now uses
libxcrypt instead. So to use crypt() function, it must always
include crypt.h (glibc 2.26 had the function in unistd.h).

glibc 2.27 deprecated libcrypt and Fedora 28 now uses
libxcrypt instead. So to use crypt() function, it must always
include crypt.h (glibc 2.26 had the function in unistd.h).
@mtasaka
Copy link
Collaborator Author

mtasaka commented Feb 15, 2018

@yama-natuki yama-natuki merged commit f50eb12 into JDimproved:test Feb 16, 2018
@ma8ma ma8ma added bugfix bug バグの追跡 and removed bugfix labels Feb 28, 2019
ma8ma added a commit that referenced this pull request Feb 16, 2020
Occurred a buffer overrun on `make test` in the case of the build
using gcc-9 with configure CXXFLAGS="-fsanitize=address
-fno-omit-frame-pointer" LDFLAGS="-fsanitize=address".

==20309==ERROR: AddressSanitizer: global-buffer-overflow on address 0x56135a804967 at pc 0x56135a235afb bp 0x7fff9ce8b3e0 sp 0x7fff9ce8b3d0
READ of size 1 at 0x56135a804967 thread T0
    #0 0x56135a235afa in MISC::is_url_scheme_impl(char const*, int*) src/jdlib/miscutil.cpp:963
    #1 0x561359a69946 in MISC::is_url_scheme(char const*, int*) ../src/jdlib/miscutil.h:272
    #2 0x561359a69946 in TestBody test/gtest_jdlib_miscutil.cpp:94
    (snip)

0x56135a804967 is located 0 bytes to the right of global variable '*.LC85' defined in 'gtest_jdlib_miscutil.cpp' (0x56135a804960) of size 7
  '*.LC85' is ascii string 'sssp:/'
0x56135a804967 is located 57 bytes to the left of global variable '*.LC86' defined in 'gtest_jdlib_miscutil.cpp' (0x56135a8049a0) of size 32
  '*.LC86' is ascii string 'MISC::is_url_scheme( "sssp:/" )'
SUMMARY: AddressSanitizer: global-buffer-overflow src/jdlib/miscutil.cpp:963 in MISC::is_url_scheme_impl(char const*, int*)
Shadow bytes around the buggy address:
  0x0ac2eb4f88d0: f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 00 00 00 05
  0x0ac2eb4f88e0: f9 f9 f9 f9 00 00 02 f9 f9 f9 f9 f9 07 f9 f9 f9
  0x0ac2eb4f88f0: f9 f9 f9 f9 00 00 00 00 f9 f9 f9 f9 06 f9 f9 f9
  0x0ac2eb4f8900: f9 f9 f9 f9 00 00 00 07 f9 f9 f9 f9 05 f9 f9 f9
  0x0ac2eb4f8910: f9 f9 f9 f9 00 00 00 06 f9 f9 f9 f9 06 f9 f9 f9
=>0x0ac2eb4f8920: f9 f9 f9 f9 00 00 00 07 f9 f9 f9 f9[07]f9 f9 f9
  0x0ac2eb4f8930: f9 f9 f9 f9 00 00 00 00 f9 f9 f9 f9 00 06 f9 f9
  0x0ac2eb4f8940: f9 f9 f9 f9 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9
  0x0ac2eb4f8950: 00 00 02 f9 f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9
  0x0ac2eb4f8960: 02 f9 f9 f9 f9 f9 f9 f9 00 05 f9 f9 f9 f9 f9 f9
  0x0ac2eb4f8970: 00 00 00 00 00 07 f9 f9 f9 f9 f9 f9 00 00 01 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==20309==ABORTING
ma8ma added a commit that referenced this pull request May 16, 2020
タイマーを使うコードで寿命管理が徹底されていなかったためメモリリークが
発生していた。スマートポインターを返すように変更してリークを修正する。

gcc-9のログ
```
Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f18a17e03d1 in operator new(unsigned long) (/lib/x86_64-linux-gnu/liblsan.so.0+0x103d1)
    #1 0x55ff4e8a91f5 in JDLIB::Timeout::connect(sigc::slot<bool, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, unsigned int) src/jdlib/timeout.cpp:54
    #2 0x55ff4df0f034 in ARTICLE::ArticleViewMain::show_instruct_diag() src/article/articleview.cpp:654
    #3 0x55ff4df15888 in ARTICLE::ArticleViewMain::update_finish() src/article/articleview.cpp:593
    #4 0x55ff4e3ed537 in SKELETON::Admin::update_finish(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) src/skeleton/admin.cpp:1645
```
@ma8ma ma8ma added the build ビルドに関するトピック label Jul 5, 2020
ma8ma added a commit that referenced this pull request Jun 10, 2023
AddressSanitizerを有効にしてスレビューを表示したときに
`Pango::FontMetrics`のオブジェクトが開放されず
メモリリークが発生したためC APIに書き直して修正します。

AddressSanitizerのレポート
```
Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fd2d34decaf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7fd2d1fa1948 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5f948) (BuildId: 88d7a1c8d79fc1becb2737be566dd98523394d55)
    #2 0x55c83a6e64a6 in ARTICLE::DrawAreaBase::init_font() ../src/article/drawareabase.cpp:357
    #3 0x55c83a6f14b7 in ARTICLE::DrawAreaBase::clear_screen() ../src/article/drawareabase.cpp:742
(snip)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fd2d34decaf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7fd2d1fa1948 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5f948) (BuildId: 88d7a1c8d79fc1becb2737be566dd98523394d55)
    #2 0x55c83a6e64a6 in ARTICLE::DrawAreaBase::init_font() ../src/article/drawareabase.cpp:357
    #3 0x55c83a6df61b in ARTICLE::DrawAreaBase::setup(bool, bool, bool) ../src/article/drawareabase.cpp:211
(snip)
```
ma8ma added a commit that referenced this pull request Jun 10, 2023
AddressSanitizerを有効にしてスレビューを表示したときに
`Pango::FontMetrics`のオブジェクトが開放されず
メモリリークが発生したためC APIに書き直して修正します。

AddressSanitizerのレポート
```
Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fd2d34decaf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7fd2d1fa1948 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5f948) (BuildId: 88d7a1c8d79fc1becb2737be566dd98523394d55)
    #2 0x55c83a6e64a6 in ARTICLE::DrawAreaBase::init_font() ../src/article/drawareabase.cpp:357
    #3 0x55c83a6f14b7 in ARTICLE::DrawAreaBase::clear_screen() ../src/article/drawareabase.cpp:742
(snip)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fd2d34decaf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7fd2d1fa1948 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5f948) (BuildId: 88d7a1c8d79fc1becb2737be566dd98523394d55)
    #2 0x55c83a6e64a6 in ARTICLE::DrawAreaBase::init_font() ../src/article/drawareabase.cpp:357
    #3 0x55c83a6df61b in ARTICLE::DrawAreaBase::setup(bool, bool, bool) ../src/article/drawareabase.cpp:211
(snip)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug バグの追跡 build ビルドに関するトピック
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants