Skip to content

Fix Travis CI build for linux#29

Open
bitnot wants to merge 1 commit into
aetilius:masterfrom
bitnot:master
Open

Fix Travis CI build for linux#29
bitnot wants to merge 1 commit into
aetilius:masterfrom
bitnot:master

Conversation

@bitnot

@bitnot bitnot commented Oct 12, 2021

Copy link
Copy Markdown
Contributor

Follow up on 99bcd4d
Sets the LIBDIR variable to lib.

Failing build
Passing build

@bitnot

bitnot commented Oct 12, 2021

Copy link
Copy Markdown
Contributor Author

@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:

Screenshot 2021-10-12 at 18 31 58

s

@aetilius

Copy link
Copy Markdown
Owner

Thanks @bitnot. I believe the travis issue is fixed now, are you able to confirm?

@G10h4ck

G10h4ck commented Oct 15, 2021

Copy link
Copy Markdown
Contributor

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

@bitnot

bitnot commented Oct 16, 2021

Copy link
Copy Markdown
Contributor Author

Thanks @bitnot. I believe the travis issue is fixed now, are you able to confirm?

Hey @aetilius.
Builds seems to be working now - see #30

I think you would have to push a new commit to make sure Travis CI can start the build.
You can see the past builds failed to start here: https://app.travis-ci.com/github/aetilius/pHash/requests

And just to make sure we are on the same page, the issue I am referring to is "Could not authorize build request for aetilius/pHash". You might want to check how you Travis CI plan is configured.

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

@G10h4ck ,
The purpose of this PR is to fix a very specific environment - Travis CI bionic linux.
I am not familiar with CMake or building C on Linux, so forgive me if I am suggesting nonsense, but it seems to me that Travis CI does not initialize the LIBDIR properly.

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.

@bitnot bitnot changed the title Fix CI build for linux Fix Travis CI build for linux Oct 16, 2021
@bitnot bitnot closed this Oct 17, 2021
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)
@bitnot bitnot reopened this Oct 17, 2021
@G10h4ck

G10h4ck commented Oct 18, 2021

Copy link
Copy Markdown
Contributor

Ok for me to merge this PR

aetilius pushed a commit to vkocheryzhkin/pHash that referenced this pull request May 25, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants