Fix Travis CI build for linux#29
Conversation
|
@aetilius, @G10h4ck could you check if this makes sense? Another note: it seems that Travis is having some trouble running the builds from the main repo: s |
|
Thanks @bitnot. I believe the travis issue is fixed now, are you able to confirm? |
|
The latest change i committed and is already merged in master should fix this already more automatically so this extra change should be not necessary |
Hey @aetilius.
@G10h4ck , On top of that there is (was?) an issue in general preventing builds in the original aetilius/pHash to start (see above). It works fine in my fork however. |
Follow up on 99bcd4d Sets the `LIBDIR` variable to `lib`. [Failing build](https://github.com/bitnot/pHash/runs/3861809127) [Passing build](https://github.com/bitnot/pHash/runs/3861825744)
|
Ok for me to merge this PR |
Addresses audit findings aetilius#7, aetilius#8, aetilius#9, aetilius#13, aetilius#14, aetilius#19, aetilius#20, aetilius#21, aetilius#29. Correctness: - aetilius#7/aetilius#8 Removed the entire HAVE_PTHREAD block (ph_audio_thread, ph_audio_hashes). It referenced types `slice` and `DP` and a function `ph_num_threads()` that were never declared anywhere in the public headers (so the block could not actually be compiled), the worker function had no return statement (UB on the void* return), and the slicing math walked one element past the input (count=10, threads=3 gave 5+3+3=11). Callers should drive ph_readaudio / ph_audiohash from their own thread pool. - aetilius#9 ph_readaudio2 now reads src_data.output_frames_gen (the count libsamplerate actually produced) instead of output_frames (the caller-supplied capacity), eliminating the downstream over-read. - ph_audiohash: corrected the nb_frames formula. The old expression could go negative for short inputs and was then passed to malloc. Memory and safety: - aetilius#13 readaudio_mp3: every error path now closes/deletes the mpg123_handle and calls mpg123_exit. Adds NULL checks on the malloc'd output, validates channels and samplerate (channels==0 would have produced an infinite loop), clamps the per-encoding inner loop so a decode that returns fewer bytes than `channels` cannot over-read the decode buffer. - aetilius#14 readaudio_snd: validates channels/samplerate/frames, checks every malloc, and frees inbuf on read failure. ph_audiohash's malloc is now checked and frame_length-sized buffers are std::vectors (no more VLAs). - aetilius#20/aetilius#21 Replaced double window[4096], double frame[4096], double magnF[2048], freqs/binbarks VLAs, and the per-filter new[] grid with std::vector. ph_audio_distance_ber preallocates `dist` once outside the per-lag loop instead of realloc'ing on every iteration; the worst-case M is just N1/block_size. - ph_compare_blocks now returns 1.0 (worst distance) rather than dividing by zero when block_size <= 0. - ph_audio_distance_ber and ph_audiohash zero their out parameters on every failure path; the previous code left Nc / nb_frames uninitialised when allocation failed. Performance: - aetilius#19 ph_bitcount uses __builtin_popcount, matching how ph_hamming_distance does its bit counting. Header hygiene (aetilius#29): - ph_fft.h includes <complex> (C++) instead of <complex.h> (C99) and drops the `using namespace std;` that was being injected into every translation unit that included it. fft() takes std::complex<double>*. - fft() now validates that N is a power of 2 (the radix-2 recursion silently misbehaves otherwise).

Follow up on 99bcd4d
Sets the
LIBDIRvariable tolib.Failing build
Passing build