main: fix crash with unsupported MP4 files
aac_frame_decode returns NULL on failure.
decodeMP4file should consequently NULL-check NeAACDecDecode's return
pointer before doing anything with it. Not doing so leads to undefined
behavior (division by zero, NULL pointer dereference, etc.)
add missing NULL-check.
fixes #13.
Hugo Lefeuvre authored 4 years ago
Hugo Lefeuvre committed 4 years ago
914 | 914 | |
915 | 915 | sample_buffer = NeAACDecDecode(hDecoder, &frameInfo, mp4config.bitbuf.data, mp4config.bitbuf.size); |
916 | 916 | |
917 | if (!sample_buffer) { | |
918 | /* unable to decode file, abort */ | |
919 | break; | |
920 | } | |
921 | ||
917 | 922 | if (adts_out == 1) |
918 | 923 | { |
919 | 924 | adtsData = MakeAdtsHeader(&adtsDataSize, &frameInfo, 0); |
1364 | 1369 | #else |
1365 | 1370 | return faad_main(argc, argv); |
1366 | 1371 | #endif |
1367 | }⏎ | |
1372 | } |