Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:32:22+00:00 2026-06-04T13:32:22+00:00

my application uses libjpeg to read/write JPEG-images. everything worked fine recently my app started

  • 0

my application uses libjpeg to read/write JPEG-images. everything worked fine

recently my app started to crash when trying to write JPEG images with an error “Wrong JPEG library version: library is 80, caller expects 62” when calling jpeg_create_compress() (so the crash seems to be an intentional abort on the libjpeg side rather than a segfault)

a bit of investigation showed that indeed my application was compiled against libjpeg-62 headers (that were installed in /usr/local/include) and was then using the dylibs from libjpeg-80 (installed in /usr/lib/i386-linux-gnu/).

removing the libjpeg-62 headers and compiling using the libjpeg-80 headers solved the problem.

however, i would appreciate a solution that would allow me to prevent such crashes, even if some end-user has a different library version installed than my app was compiled against.

1) it would be great if i could somehow convince libjpeg to not abort even on fatal errors;
e.g. something like:

jpeg_abort_on_error(0);

2) or have a non-aborting check whether the correct library is installed:

if(!jpeg_check_libraryversion()) return;

3) if that’s not doable out of the box, i’m fine with manually checking the compile-time API-version (JPEG_LIB_VERSION) against a compat-version detected at runtime.

unfortunately i have not been able to find anything in the API that would allow me to use either of those methods.

am i just blind or do i need a something completely different?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:32:24+00:00Added an answer on June 4, 2026 at 1:32 pm

    setting up an error-handler for error_exit prevents the application from crashing.

    (my problem was that i had this done for the load-functionality, but not for the save-functionality, hence it exited when there were problems during saving).
    something like the following did the trick:

    struct my_error_mgr {
      struct jpeg_error_mgr pub;    // "public" fields
      jmp_buf setjmp_buffer;    // for return to caller
    };
    typedef struct my_error_mgr * my_error_ptr;
    
    METHODDEF(void) my_error_exit (j_common_ptr cinfo) {
     my_error_ptr myerr = reinterpret_cast<my_error_ptr> (cinfo->err);
     /* Return control to the setjmp point */
     longjmp(myerr->setjmp_buffer, 1);
    }
    
    /* ... */
    
    void jpeg_save(const char*filename, struct image*img) {
      /* ... */
      /* We set up the normal JPEG error routines, then override error_exit */
      my_error_mgr jerr;
      cinfo.err = jpeg_std_error(&jerr.pub);
      jerr.pub.error_exit = my_error_exit;
    
      /* Establish the setjmp return context for my_error_exit to use. */
      if ( setjmp(jerr.setjmp_buffer) ) {
        /* If we get here, the JPEG code has signaled an error.
         * We need to clean up the JPEG object, close the input file, and return. */
        jpeg_destroy_compress(&cinfo);
        if(outfile)fclose(outfile);
        return(false);
      }
      /* ... */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our application uses a SQL Server back-end with many stored procedures. Recently, while trying
Our application uses H2Sharp to access a H2 database from C# (Framework v4). Recently
My application uses WideImage successfully to crop & resize images. I call this on
my application uses the standard app.config to store the public configuration data. However, there
My application uses Hibernate to connect to SQL Server. I recently changed my DAO
My application uses Devise authentication gem. When i do rake db:migrate locally, everything is
My application uses a list of media files on the phone, i.e. images, audio
My application uses MS access database to save some sensitive information. Though that information
Our application uses SQL Server Reporting Services and allows users to add custom filters
Our application uses Hibernate with Sql Server 2005. Being a DBA, I am not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.