kosma / minmea

a lightweight GPS NMEA 0183 parser library in pure C
Do What The F*ck You Want To Public License
735 stars 246 forks source link

Fix Integer Overflow #31

Closed gy741 closed 6 years ago

gy741 commented 6 years ago

Hello,

I simply modified the source.

Please confirm.

Thanks.

karas:~/minmea$ make test
cc -g -O3 -Wall -Wextra -Werror -std=c99 -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -pthread   -c -o tests.o tests.c
cc -g -O3 -Wall -Wextra -Werror -std=c99 -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -pthread   -c -o minmea.o minmea.c
cc   tests.o minmea.o  -lcheck_pic -pthread -lrt -lm -lsubunit -o tests
+++ Running Check test suite...
./tests
Running suite(s): minmea
100%: Checks: 33, Failures: 0, Errors: 0
hraftery commented 6 years ago

I don’t think your change fixes the problem. What makes you think being negative is a problem? Isn’t the issue overflow? Besides, the first part of the if statement would now be redundant, which makes it look like a mistake.

On 21 Feb 2018, at 4:10 pm, gy741 notifications@github.com wrote:

Hello,

I simply modified the source.

Please confirm.

Thanks.

karas:~/minmea$ make test cc -g -O3 -Wall -Wextra -Werror -std=c99 -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -pthread -c -o tests.o tests.c cc -g -O3 -Wall -Wextra -Werror -std=c99 -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -pthread -c -o minmea.o minmea.c cc tests.o minmea.o -lcheck_pic -pthread -lrt -lm -lsubunit -o tests +++ Running Check test suite... ./tests Running suite(s): minmea 100%: Checks: 33, Failures: 0, Errors: 0 You can view, comment on, or merge this pull request online at:

https://github.com/kosma/minmea/pull/31 https://github.com/kosma/minmea/pull/31 Commit Summary

Fix Integer Overflow File Changes

M minmea.h https://github.com/kosma/minmea/pull/31/files#diff-0 (2) Patch Links:

https://github.com/kosma/minmea/pull/31.patch https://github.com/kosma/minmea/pull/31.patch https://github.com/kosma/minmea/pull/31.diff https://github.com/kosma/minmea/pull/31.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kosma/minmea/pull/31, or mute the thread https://github.com/notifications/unsubscribe-auth/AFRsb9StjLisTGKv2IU1svv8Y2rdwFRKks5tW6VVgaJpZM4SNFid.

gy741 commented 6 years ago

Hello,

I agree.

Thank you for your feedback.

Thanks.