Bug 1455826 - jasper broken with default standards c++ after security update
Summary: jasper broken with default standards c++ after security update
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: jasper
Version: 25
Hardware: All
OS: All
high
high
Target Milestone: ---
Assignee: Josef Ridky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1455287
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-26 08:40 UTC by Josef Ridky
Modified: 2017-05-26 12:42 UTC (History)
5 users (show)

Fixed In Version:
Clone Of: 1455287
Environment:
Last Closed: 2017-05-26 11:46:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Josef Ridky 2017-05-26 08:40:55 UTC
Jasper worked fine with 0:1.900.1-16.el6_6.3 but no longer works after update to 0:1.900.1-21.el6_9

--

Simple reproducer

#include <iostream>
#include <jasper/jasper.h>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}

# g++ test.cpp
In file included from /usr/include/jasper/jasper.h:77,
                 from test.cpp:2:
/usr/include/jasper/jas_math.h: In function ‘bool jas_safe_size_mul(size_t, size_t, size_t*)’:
/usr/include/jasper/jas_math.h:143: error: ‘SIZE_MAX’ was not declared in this scope
/usr/include/jasper/jas_math.h: In function ‘bool jas_safe_size_add(size_t, size_t, size_t*)’:
/usr/include/jasper/jas_math.h:170: error: ‘SIZE_MAX’ was not declared in this scope

--- Additional comment from Josef Ridky on 2017-05-25 02:46:10 EDT ---

Problem is in stdint.h header file due this statement:

/* The ISO C99 standard specifies that in C++ implementations these
   macros should only be defined if explicitly requested.  */
#if !defined __cplusplus || defined __STDC_LIMIT_MACROS

Compiling with g++ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS foo.cpp will fix this issue.

--- Additional comment from Tomas Hoger on 2017-05-25 06:13:14 EDT ---

Would we fix this by:

#ifndef SIZE_MAX
#define SIZE_MAX ((size_t) - 1)
#endif

added to jas_math.h after:

#include <stdint.h>

possibly inside of:

#ifdef __cplusplus

?

Comment 1 Josef Ridky 2017-05-26 11:46:39 UTC
This issue is not presented in Fedora distribution.

Comment 2 Tomas Hoger 2017-05-26 12:42:38 UTC
It seems the above workaround should not be needed when using glibc 2.18 and later:

https://sourceware.org/bugzilla/show_bug.cgi?id=15366
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1ef74943ce2f114c78b215af57c2ccc72ccdb0b7


Note You need to log in before you can comment on or make changes to this bug.