~ubuntu-branches/ubuntu/trusty/libwpd/trusty

« back to all changes in this revision

Viewing changes to src/lib/WP6EOLGroup.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Rene Engelhard
  • Date: 2006-07-15 11:58:12 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060715115812-v18efmdayby4clau
Tags: 0.8.6-1
* New upstream release
* swap maintainer/uploader

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        m_isMinimumHeight(true),
58
58
        m_rowHeight(0),
59
59
        m_isDontEndAParagraphStyleForThisHardReturn(false)
60
 
 
61
60
{
62
61
        _read(input);
63
62
}
72
71
void WP6EOLGroup::_readContents(WPXInputStream *input)
73
72
{
74
73
        WPD_DEBUG_MSG(("WordPerfect: EOL Group: Reading Embedded Sub-Function Data\n"));
75
 
        uint16_t sizeDeletableSubFunctionData;
76
74
        unsigned int startPosition = input->tell();
77
 
        sizeDeletableSubFunctionData = readU16(input);          
 
75
        uint16_t sizeDeletableSubFunctionData = readU16(input);         
78
76
        WPD_DEBUG_MSG(("WordPerfect: EOL Group: Size of Deletable Sub-Function Data: %ld,  Size of Deletable and Non-deletable sub-function data: %ld\n", (long) sizeDeletableSubFunctionData, (long) getSizeNonDeletable()));
 
77
        if ((long)sizeDeletableSubFunctionData > (long)getSizeNonDeletable())
 
78
        {
 
79
                WPD_DEBUG_MSG(("WordPerfect: EOL Group: Possible corruption detected, bailing out\n"));
 
80
                throw FileException();
 
81
        }
 
82
 
79
83
        input->seek(sizeDeletableSubFunctionData, WPX_SEEK_CUR);
80
84
        while (input->tell() < (startPosition + getSizeNonDeletable()))
81
85
        {
231
235
                                numBytesToSkip = WP6_EOL_GROUP_DONT_END_A_PARAGRAPH_STYLE_FOR_THIS_HARD_RETURN_SIZE;
232
236
                                m_isDontEndAParagraphStyleForThisHardReturn = true;
233
237
                                break;
 
238
                        case 0x8e:
 
239
                        case 0x8f:
 
240
                                WPD_DEBUG_MSG(("WordPerfect: EOL Group Embedded Sub-Function: UNKNOWN SUBFUNCTION (%x) (BAD BAD BAD)\n", byte));
 
241
                                numBytesToSkip = readU16(input); // It seems that these two unknow sub-functions have their
 
242
                                                                 // length information embedded: <subfunction>[length]...[length]<subfunction>
 
243
                                break;
234
244
                        default:
235
 
                                // unsupported: shouldn't happen! an error may follow
236
 
                                // HACK: one document seems to have a completely bogus value within 
237
 
                                // pre-emptively throw a parsing exception
238
245
                                WPD_DEBUG_MSG(("WordPerfect: EOL Group Embedded Sub-Function: UNKNOWN SUBFUNCTION (%x) (BAD BAD BAD)\n", byte));
239
 
                                throw ParseException();
 
246
                                WPD_DEBUG_MSG(("WordPerfect: Possible corruption detected, bailing out\n"));
 
247
                                throw FileException();
240
248
                }                       
241
249
                
242
250
                input->seek((startPosition2 + numBytesToSkip - 1 - input->tell()), WPX_SEEK_CUR);