wedesoft/anymeal

librecode can hang for invalid conversions

bkmgit opened this issue · 5 comments

bkmgit commented

The tests require google test sources:

Might it be possible to directly link to a pre-compiled libgtest ? This could be
added as an additional configuration option.

Ok, I have changed the configure script to look for Googletest source code as well as libgtest. I have tested it with both configurations. Let me know if I should make a new release with this change.

bkmgit commented

Thanks for this update. Tested on both Googletest 1.12 and 1.13 so can relax the version to at least include those. #41
A new release would be great.

bkmgit commented

Recode exception test seems to timeout https://download.copr.fedorainfracloud.org/results/fed500/anymeal/fedora-rawhide-x86_64/06541861-anymeal/builder-live.log

On the command line trying

$ echo Äpfel > test.txt
$ recode utf8..ascii test.txt 
recode: /home/fedora/test.txt failed: Untranslatable input in step `ISO-10646-UCS-2..ANSI_X3.4-1968'
bkmgit commented

The following program also hangs:

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <recodext.h>

const char *program_name;

int
main (int argc, char *const *argv)
{
  program_name = argv[0];
  RECODE_OUTER outer = recode_new_outer (true);
  RECODE_REQUEST request = recode_new_request (outer);
  char input_buffer[10] = "Äpfel";
  char *output_buffer;
  size_t output_length;
  size_t input_length = 6;
  size_t output_allocated;
  bool success;

  success = recode_scan_request (request, "latin1..ascii");
  request->verbose_flag = true;
  success = recode_buffer_to_buffer(request,
                  input_buffer, input_length,
                  &output_buffer, &output_length, &output_allocated);
  if (success) printf("%s\n",output_buffer);
  
  recode_delete_request (request);
  recode_delete_outer (outer);

  exit (success ? 0 : 1);
}

So probably an issue with recode library.

I switched to iconv and released version 1.26. I hope this will work better since it is part of GNU libc.