Skip to content

Commit

Permalink
Added a check in the JP2 encoder to ensure that the image to be coded
Browse files Browse the repository at this point in the history
has at least one component.
Also, made some small changes to a private build script.
  • Loading branch information
mdadams committed Mar 6, 2017
1 parent 51334ca commit 58ba036
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build/my_build
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if [ -n "$CC" ]; then
echo "C compiler $CC"
fi

sde_gcc="$sde_top_dir/bin/gcc"
#sde_gcc="$sde_top_dir/bin/gcc"
sde_setup="$sde_top_dir/bin/sde_make_setup"
eval $("$sde_setup") || panic "setup failed"

Expand All @@ -70,9 +70,9 @@ fi
opts=()
opts+=(-B"$build_dir")
opts+=(-H"$source_dir")
if [ -n "$sde_top_dir" ]; then
opts+=("-DCMAKE_C_COMPILER=$sde_gcc")
fi
#if [ -n "$sde_top_dir" ]; then
# opts+=("-DCMAKE_C_COMPILER=$sde_gcc")
#fi
opts+=("-DCMAKE_INSTALL_PREFIX=$install_dir")
opts+=("-DJAS_ENABLE_STRICT=true")
if [ "$enable_debug" -ne 0 ]; then
Expand Down
5 changes: 5 additions & 0 deletions src/libjasper/jp2/jp2_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr)
iccstream = 0;
iccprof = 0;

if (jas_image_numcmpts(image) < 1) {
jas_eprintf("image must have at least one component\n");
goto error;
}

allcmptssame = 1;
sgnd = jas_image_cmptsgnd(image, 0);
prec = jas_image_cmptprec(image, 0);
Expand Down

0 comments on commit 58ba036

Please sign in to comment.