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

#46 の(とりあえずの)修正 #48

Merged
merged 1 commit into from Mar 7, 2019

Commits on Mar 6, 2019

  1. Fix JDimproved#46

    現在一部のmalloc()で
    foo *bar = ( foo * ) malloc( buzz ) ;
    という形で"buffバイト"のヒープを確保したあとそのポインタに対して
    bar[ buzz ] ;
    のように"buff個目の要素"としてアクセスしているため、fooが1バイト場合を除き要素の後ろの部分でオーバーフローが発生しています。
    
    例)
    buzz=5、fooが1要素当たり4バイトの場合、確保されたメモリは5バイトなのに対して bar[5] は 4*5=20 バイト目となる
    
    foo *bar = ( foo * ) malloc( sizeof( foo ) * buzz ) ;
    として正しいバイトを確保するように修正します。
    
    また、charは1バイトが保証されているため変更せず
    Bytefは現状1バイトのようですがその保証が有るのか確認できなかったためsizeof(Bytef)に
    末尾の +64 は番兵のようなので変更せず
    としました。
    taro-yamada committed Mar 6, 2019
    Configuration menu
    Copy the full SHA
    3e2a861 View commit details
    Browse the repository at this point in the history