X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpfb.cc;h=101f4f0fc68a7c947470b226b0fcb903b6395046;hb=5d84bfad4626892bcffd05adcced53c8a2329047;hp=4f371c6c9446af214fb7752103d37270f181cbce;hpb=65a0059b69385985896a24f407b3a791d33aef0f;p=lilypond.git diff --git a/lily/pfb.cc b/lily/pfb.cc index 4f371c6c94..101f4f0fc6 100644 --- a/lily/pfb.cc +++ b/lily/pfb.cc @@ -24,6 +24,7 @@ #include using namespace std; +#include "international.hh" #include "program-option.hh" #include "source-file.hh" #include "memory-stream.hh" @@ -40,7 +41,10 @@ pfb2pfa (const vector &pfb) while (p < pfb.end ()) { if (static_cast(*p++) != 128) - break; + { + error (_ ("Segment header of the Type 1 (PFB) font is broken.")); + break; + } Byte type = static_cast(*p++); if (type == 3) @@ -50,6 +54,11 @@ pfb2pfa (const vector &pfb) seglen |= (static_cast(*p++) << 8); seglen |= (static_cast(*p++) << 16); seglen |= (static_cast(*p++) << 24); + if ((p + seglen) > pfb.end ()) + { + error (_ ("Segment length of the Type 1 (PFB) font is too long.")); + break; + } if (type == 1) { @@ -72,6 +81,11 @@ pfb2pfa (const vector &pfb) string str = ss.str (); copy (str.begin (), str.end (), back_inserter (out)); } + else + { + error (_ ("Segment type of the Type 1 (PFB) font is unknown.")); + break; + } } return out;