Ignore:
Timestamp:
Feb 1, 2018, 4:21:53 PM (23 months ago)
Author:
matszpk
Message:

CLRadeonExtender: ROCmMetadata: Do not accept block string inside array []. Fixed prevIndent in consume method call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdbin/ROCmBinaries.cpp

    r3692 r3693  
    312312
    313313static std::string parseYAMLStringValue(const char*& ptr, const char* end, size_t& lineNo,
    314                     cxuint prevIndent, bool singleValue = false)
     314                    cxuint prevIndent, bool singleValue = false, bool blockAccept = true)
    315315{
    316316    skipSpacesToLineEnd(ptr, end);
     
    323323    else if (*ptr == '|' || *ptr == '>')
    324324    {
     325        if (!blockAccept)
     326            throw ParseException(lineNo, "Illegal block string start");
    325327        // multiline
    326328        bool newLineFold = *ptr=='>';
     
    415417public:
    416418    virtual void consume(const char*& ptr, const char* end, size_t& lineNo,
    417                 cxuint prevIndent, bool singleValue) = 0;
     419                cxuint prevIndent, bool singleValue, bool blockAccept) = 0;
    418420};
    419421
     
    432434        {
    433435            // parse in line
    434             elemConsumer->consume(ptr, end, lineNo, 0, false);
     436            elemConsumer->consume(ptr, end, lineNo, 0, false, false);
    435437            skipSpacesAndComments(ptr, end, lineNo);
    436438            if (ptr!=end && *ptr==']')
     
    468470        if (afterMinus == ptr)
    469471            throw ParseException(lineNo, "No spaces after '-'");
    470         elemConsumer->consume(ptr, end, lineNo, indent0+1 + ptr-afterMinus, true);
     472        elemConsumer->consume(ptr, end, lineNo, indent0, true, true);
    471473       
    472474        size_t indent = skipSpacesAndComments(ptr, end, lineNo);
     
    496498   
    497499    virtual void consume(const char*& ptr, const char* end, size_t& lineNo,
    498                 cxuint prevIndent, bool singleValue)
     500                cxuint prevIndent, bool singleValue, bool blockAccept)
    499501    {
    500502        if (elemsNum == requiredElemsNum)
     
    522524   
    523525    virtual void consume(const char*& ptr, const char* end, size_t& lineNo,
    524                 cxuint prevIndent, bool singleValue)
     526                cxuint prevIndent, bool singleValue, bool blockAccept)
    525527    {
    526528        const size_t oldLineNo = lineNo;
    527         std::string str = parseYAMLStringValue(ptr, end, lineNo, prevIndent, singleValue);
     529        std::string str = parseYAMLStringValue(ptr, end, lineNo, prevIndent,
     530                                singleValue, blockAccept);
    528531        // parse printf string
    529532        ROCmPrintfInfo printfInfo{};
Note: See TracChangeset for help on using the changeset viewer.